How to use SVN to update WordPress
I finally sat down and ripped my code apart to make it possible for me to manage my WordPress installations via SVN. Sure, it was a boon when I started diff’ing the files rather than trying to change by hand, but this time around it took me less than 5 seconds to update to WordPress 1.5.1.2. The power of SVN and version control.
You can do this too, and the good news is that it’s not hard. This tutorial will walk you through the basics of setting up your blog to pull from the SVN repositories. You can use this just to update, or you could start running bleeding-edge code and help develop WordPress!
Prerequisites
- SSH access. It’s possible to get things done via some PHP hacks, but you’re better off looking at a host that provides what you need than trying to hack around. With hosting prices so cheap these days, there’s no reason you shouldn’t find a better host for the same money. Those of you hosting with me, yes you have all the tools necessary. Ask your host if they allow SSH and if they can enable it for you.
Wikipedia: SSH - An SSH client. It should go without saying. Mac and Linux users have clients built-in. Windows users need PuTTY, an easy-to-use SSH client.
- Subversion binaries. Hosts with Subversion are still a bit hard-to-find, but many are willing to install it on request. Log in via SSH and issue the command
whereis svnto see if it is installed on your system. - Vanilla WordPress. This is where the time and work come in. For SVN to work to its utmost potential, you need to leave all WordPress core files untouched. This means moving your changes to
wp-config.phporwp-content/(as either a plugin or part of your theme). In my case, I had to move my custom smilies towp-config.php(above the include() ofwp-settings.php) and break out some custom post handling into my theme. If you’ve customized the default theme, rename that theme directory from default to something else. That way it won’t be overwritten by SVN. Matt Mullenweg himself recommends that core files not be touched. - At least 45 minutes to an hour. If something breaks terribly, you don’t want to have to leave your blog in an unfinished state. Although it should take less than 15 minutes to perform these steps, don’t rush and the upgrade will go better. I’ve been switching stuff to SVN for so long that I had my blog moved in about 10 minutes, so times improve.
Nice guide Seth, very helpful!
Only problem is, I got as far as the first step on the second page, until it told me Shell access is not enabled on this account so I couldn’t carry on :S
I’ll enable it for your account now.
Excellent! It’s so much quicker and easier.
Thanks a lot for writing this, it cetainly helped me out ^_^
[...] I’m sorry, WordPress is as only as good as the folks messing around with the innards. So it’s damn good. Since the inception of this crappy little blog that barely anyone visits, I’ve been using Subversion to manually update the blog to the latest and greatest version of WordPress being crafted for the masses. So I’m pretty happy about the ease with which I’m able to bring things up to speed and take advantage of what’s cooking with the crafty contributors to WordPress. [...]
[...] How to use SVN to update WordPress [...]
[...] Updating WordPress via SVN is about a million times easier than updating it the old way. [...]
[...] installation. I recommend reading the more detailed page on the WordPress site, and both pages of Seth Kinast’s entry on the [...]