Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subversion branch question

Tags:

branch

svn

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?

like image 483
Rob Avatar asked Aug 07 '09 06:08

Rob


2 Answers

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"
like image 126
Simone Carletti Avatar answered Oct 23 '22 05:10

Simone Carletti


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.

like image 23
Quinn Taylor Avatar answered Oct 23 '22 06:10

Quinn Taylor