Branching is a powerful and useful feature of Apache Subversion but, because it has a reputation for being difficult to master, many users never take advantage of it. In this post we’ll show you how to create a new branch, and then switch to this branch ready to begin working on its contents.
Creating a Branch in 5 Steps
1) To get started, right click on the folder you want to copy to a branch, and select the ‘Branch/Tag’ option from the TortoiseSVN menu.
2) In the ‘To path’ box, enter the location you want your branch to be copied to.
3) Enter a log message in the ‘Log message’ box.
4) Select which revision you wish to copy (this is typically HEAD revision, but you can specify another revision, if required.)
5) Click ‘OK.’
You have now created your branch!
3 Steps to Switch to Your New Branch
Now you’ve created a new branch, you’ll need to switch to it in order to begin working on its contents.
1) Right-click on the top level folder of your project and select ‘Switch’ from the TortoiseSVN context menu.
2) Enter the URL of the new branch you just created.
3) Ensure the ‘Head Revision’ button is selected, and click ‘Ok.’
The new branch will appear in your working copy!
Note, any changes that have not been committed to the repository will be merged when you run the switch command. Make sure you’ve either committed your changes before performing the switch, or revert your working copy to a revision that has already been committed to the repository.
Need more Subversion know-how? After getting a great response from the Apache Subversion community in 2011, Subversion Live is back for 2012, bringing the Subversion community sessions covering everything from Subversion’s future, to expert-led best practices workshops, as well as the unique opportunity to meet the core Subversion committers.