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?
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"
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With