Friday, April 18, 2014

SVN : Merge branch to trunk

Merging a branch to trunk in SVN is not as straight forward as in the case of GIT. It's a bit lengthy process as it needs a number of steps to be followed. Below the series of the steps one should follow.

1. Check out a copy of trunk:
   svn co svn+ssh://server/path/to/trunk

2. Check out a copy of the branch you are going to merge:
   svn co svn+ssh://server/path/to/branch/myFeatureBranch

3. Change your current working directory to “
myFeatureBranch”. Find the revision “myFeatureBranch” began at:
   svn log --stop-on-copy

This should display back to you the changes that have been made back to the point the feature branch was cut. Remember that number (should be rXXX, where XXX is the revision number).

4. Change your current working directory to trunk and perform an SVN update:
   svn up

This will update your copy of trunk to the most recent version, and tell you the revision you are at. Make note of that number as well (should say “At revision YYY” where YYY is the second number you need to remember).

5. Now we can perform an SVN merge:
   svn merge -rXXX:YYY svn+ssh://server/path/to/branch/
myFeatureBranch

This will put all updates into your current working directory for trunk. Resolve any conflicts that arose during the merge

6. Check in the results:
   svn ci -m "MERGING
myFeatureBranch [XXX]:[YYY] into trunk"

1 comment :