Reputation: 20066
I started working on what I thought would be a small change to trunk, walked away for a month and now I realize this is really a whole side-project (full of bugs) that really needs its own branch. Furthermore, once I've branched these changes off, I want to reset my working copy back to what's currently in trunk so I can help out the main development effort and high-priority items before coming back to this side project when there's time.
So:
I would like to make a new branch, based on my working copy, without having to check in my working copy (it IS up to date with the latest HEAD revision though)
Once I have forked my working copy, I would like to basically remove all changes that are in the branch, and just set it to match the current HEAD revision in trunk.
What's the procedure? I'm using TortoiseSVN, but even command line instructions would be helpful.
Upvotes: 19
Views: 19194
Reputation: 761
In case you prefer to continue working on in the same folder, this post shows how to.
Basically svn copy
to create a branch svn switch
to point to new branch from the same working copy and svn commit
to commit your changes.
Be sure you branch off your from the same branch/revision you started modify (svn info
to check) or you may endup with many conflicts after switch.
Upvotes: 4
Reputation: 13468
In command-line you can create a patch with the subversion "diff" command, and then apply it to your new branch with the subversion "patch" command. (You can read about these commands by executing 'svn help diff' and 'svn help patch'). Let's say you have the trunk and a branch called new_branch in the same parent directory.
cd trunk
svn diff > ..\my_stuff.diff
Now you have the patch, then apply it to your newly created branch.
cd new_branch
svn patch ..\my_stuff.diff
You can dry run the patch first by adding the --dry-run flag to the patch command, to see if anything strange happens before actually applying it.
svn patch ..\my_stuff.diff --dry-run
Upvotes: 3
Reputation: 20066
So I've tried two methods to branching my working copy without checking it in, not sure which one is going to end up being the best method:
Method 1: Copy entire directory to new branch
Method 2: use Branch/tag
It looks like Method 2 is definitely preferable.
Then, to clean up, it was a matter of Tortoise SVN > Revert... and "Delete all unversioned"
Upvotes: 13