Creating a branch in Subversion from a specific older revision

Branches in Subversion are quite easy and really lightweight. I think the technical term for this is “cheap copy”, which doesn’t quite do it for me. I mean, I’d rather call it an elegant and efficient copy, but I didn’t create my own version control system.

To create a branch of your source base in Subversion, you usually just execute (if you’re using the file-based version and the repository is in /Users/yourName/svn):

svn copy file:///Users/yourName/svn/yourProject/trunk file:///Users/yourName/yourProject/branches/yourProject-1.0

Note that you need to have the branches directory added and committed to your repository. It won’t automatically add this for you.

This does it for working from the head of the trunk. But what if you wanted to branch from an older revision? It turns out to be quite easy:

svn copy -r specificRevisionNumber file:///Users/yourName/svn/yourProject/trunk file:///Users/yourName/yourProject/branches/yourProject-1.0