Zialus asked me to explain how I keep my blog’s theme up to date using SVN while keeping my modifications. The answer is too long for Twitter, so I’m writing a small blog post about it.
- I checked out a copy of the theme I use to my computer (easier to work on it from my PC than my server). The SVN URL for themes hosted on WordPress.org is
http://themes.svn.wordpress.org/
. Find your theme there. For example my blog’s theme ishttp://themes.svn.wordpress.org/mystique/1.72/
(as of the time of this post). - I made the changes I wanted to the theme on my computer (tweaks and such) and then uploaded it to my server.
- When a new version of the theme is released, I run
svn diff > file.diff
on my local checkout to get a file containing all of my modifications (this will be handy for the next step). - I use
svn switch
to switch to the new version SVN URL. Your SVN client will attempt to merge in any changes by the theme author into your modified files, but it may run into collisions (where the theme’s author and you have modified the same area of a file). You’ll need to manually fix any collisions (this is why I check out to my PC instead of my server). I tend to just hit revert on the file and then using the diff file from the previous step for reference, re-add my modifcations. - Upload the new version of the theme (with your modifications to your server).
Questions? Feel free to ask via my comments section. 🙂
Sounds like a good approach if your changes are fairly simple. Otherwise, you need revision control for your own changes as well. I’ve put themes in git, svn meta files and all 😉
Lloyd, you might consider using the git-svn bridge, which ties an svn repo to git much more gracefully than simply adding all the files to both at the same time.
I really gotta learn git. I’ve been avoiding it due to lack of a GUI, but I’m getting more comfortable with command line, so maybe it’s time…
Good idea. I’ve been thinking about using svn:externals to manage my plugins, but thinking that automatic upgrade is going to be easier.
Still SVN is the best way I think to keep your site updated (if you have shell access, of course).
Pingback: WordPress Picks for the Week [02/17] | Techtites