howto: branch working copy changes without committing?

Nyhm
Nyhm
Suppose I have a working copy of [url]http://server/trunk[/url]. 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!

Last updated

Nyhm
Nyhm
rtfm OK, so I RTFM again (by the way [url]http://svnbook.red-bean.com/[/url] is the best technical manual I've ever read). My original post describes [b]switch[/b]ing 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. [code] svn copy [url]http://server/trunk[/url] [url]http://server/branches/my-branch[/url] svn switch /local/trunk [url]http://server/branches/my-branch[/url] svn commit /local/trunk -m "committing to branch" svn switch /local/trunk [url]http://server/trunk[/url] svn update /local/branches [/code] I 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. [code] svn commit /local/branches/my-branch -m "all changes" svn update /local/trunk svn merge -r 10:HEAD [url]http://server/branches/my-branch[/url] /local/trunk svn commit /local/trunk -m "merged my-branch from r10:15 into trunk" [/code] 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.

Post a reply
34411 views