Subversion Unit Question

I checked the specific Subversion branch of my application. Name it "1.0". I worked on some changes, added some new files, etc., but havenโ€™t made any changes yet. However, I do not want to commit changes to the "1.0" branch. Instead, I want to make changes to the new branch "1.1".

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

Is there an easier way to do this?

+6
branch svn
source share
3 answers

You can remotely create a branch, then switch to a 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" 
+9
source share

In fact, you can create a branch without having a bootable working copy using only remote URLs. If you are svn copy trunk (or branch 1.0) to branches 1.1, you can make svn switch to move the working copy to point to the new branch, and then commit there. (If you havenโ€™t done something similar before, itโ€™s advisable to back up your current working copy so that 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 the svn help switch for more details.

+3
source share

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

+2
source share

All Articles