howto: branch working copy changes without committing?
Suppose I have a working copy of http://server/trunk. I've been editing code in my working copy of /local/trunk. Then I decide I'd rather be working in a branch (say /local/branches/mybranch). How do I make the branch with my local changes to trunk without committing trunk? Something like: svn copy /local/trunk /local/branches/mybranch svn add /local/branches/mybranch svn commit /local/branches/mybranch -m "branching working changes to trunk" Then I can revert /local/trunk (because I'll be doing a merge when my branch is ready). This sounds right, but is it the proper way to handle my situation? Thank you in advance, svn community!
rtfm OK, so I RTFM again (by the way http://svnbook.red-bean.com/ is the best technical manual I've ever read). My original post describes switching my local changes into a branch. So, create a branch, switch my trunk to it, commit my local "trunk" changes (which go to the switched-to branch), then update on my working copy of the branch. I now have a branch with my working changes in it. I should switch my trunk back to the real trunk URL, then revert my trunk to avoid confusion. When finished committing all my branch changes, merge the branch from the branch point (revision) up to HEAD into trunk. Branch can be removed to avoid confusion. Here's a rundown of the command lines: First, note that I've made changes to /local/trunk that I do not want to commit.
svn copy http://server/trunk http://server/branches/my-branch svn switch /local/trunk http://server/branches/my-branch svn commit /local/trunk -m "committing to branch" svn switch /local/trunk http://server/trunk svn update /local/branchesI must note the initial revision number of the branch, say 10. Now I have /local/branches/my-branch to work in. Next, I'll commit changes to the branch, then merge it into trunk. Let's say the HEAD revision of trunk is 15.
svn commit /local/branches/my-branch -m "all changes" svn update /local/trunk svn merge -r 10:HEAD http://server/branches/my-branch /local/trunk svn commit /local/trunk -m "merged my-branch from r10:15 into trunk"I can also remove the branch if I'm not going to be working in it anymore. Very sensible process once you get in tune with subversion's basic concepts!
1-2 of 2
Reply to this discussion
You cannot edit posts or make replies: You should be logged in before you can post.