Oftentimes you have changes in your working copy that you’d like to preserve but not taint the trunk with it. Maybe you’d like to work on it later, or perhaps you’d just like to branch off features so that you don’t interfere with a trunk moving to stable. The trouble is, you didn’t decide beforehand that you have to create a branch. How do you solve this problem? Enter svn switch.

Here’s how you do it:

svn copy url-to-trunk url-to-new-branch -m "Creating a new branch"
svn switch url-to-new-branch
svn commit -m "Commiting my changes to new branch."

You’d still be in the old working copy however, but one that points to the new svn url. That’s confusing, so as soon as you commit your changes, rm -rf everything and check out your trunk and branches again.

For technology information and latest programming language news. Visit http://sig9.com