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 svn to 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.php or wp-content/ (as either a plugin or part of your theme). In my case, I had to move my custom smilies to wp-config.php (above the include() of wp-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.
Dewdles by Sam