Skip to main content
  1. Posts/

Sane Merging in SVN

We use Subversion for version control at work . We try to version control everything: code, content, graphics, site configuration. Everything . This does wonders for our sanity, but we can do more. Recently (n < 6 months)) we’ve started doing something we should have done from Day 1: develop in one tree, deploy in another. In our case we’re developing in the trunk, and there’s a long-lived branch cleverly named production. This is great, with one little problem: cherry-picking revisions to merge in Subversion is a pain in the ass.

Last week I was looking at the upcoming features in Subversion 1.5. Asheesh had pointed out the merge tracking feature, which sounded lovely. And it probably will be. The thing I discovered, though, is that you can get it today in the form of svnmerge .

svnmerge allows you to track what revisions you’ve merged from a branch (or trunk), block certain revisions (features you might not want to deploy just yet), and performs the merges for you when that time arrives (including generating a nice commit message containing all the log messages you’re merging; handy). I spent an hour yesterday and an hour today getting the merges recorded for the packages I’m currently working on, and it already feels better. No more wondering if I remembered to merge something; just svnmerge avail and see if anything shows up.

Sure, it’ll be great to get this feature into the core application (and an interactive mode ala darcs would be slick, too), but to paraphrase Scarlett O’Hara, “with god as my witness, I will never svn merge again”.