tags:

views:

156

answers:

3

I have checked out a specific Subversion branch of my app. Call it '1.0'. I have been working on some changes, added some new files, etc. but haven't committed the changes yet. However, I don't want to commit the changes to the '1.0' branch. Instead, I want to commit my changes to a new '1.1' branch.

As far as I can see I will need to first check out a fresh copy of the '1.0' branch, then create a new Subversion branch called '1.1' and then manually copy my pending changes over before committing.

Is there an easier way to do this?

+2  A: 

svn switch lets you switch your working copy to a different branch. You can create the branch beforehand without checking out a new copy with svn copy <repository>/branches/1 <repository>/branches/2

Ville Sundberg
+2  A: 

You can actually create a branch without having a checked-out working copy at all, using only remote URLs. If you do an svn copy of the trunk (or 1.0 branch) to a 1.1 branch, you can then do an svn switch to move your working copy to point to the new branch then commit there. (If you haven't done something like this before, it's wise to save a backup of your current working copy so you don't lose your modifications.)

For example...

svn copy http://svn.example.com/branches/1.0/ \
         http://svn.example.com/branches/1.1/ \
    -m "Creating 1.1 branch."

cd /path/to/working/copy
svn switch http://svn.example.com/branches/1.1/

Take a look at svn help switch for more details.

Quinn Taylor
+9  A: 

You can remote-create a branch, then switch to the new branch and commit the changes.

$ cd /path/to/working
$ svn copy svn://my/repos/trunk svn://my/repos/branches/1.1 -m "Created branch 1.1"
$ svn switch svn://my/repos/branches/1.1
$ svn commit -m "Your message"
Simone Carletti
you may want to copy the branch rather than the trunk in the second line.
Andrew Cox
This did the trick. Thanks very much.
Rob