Subversion: Merging a Branch into Trunk
Posted by Ryan Baxter Wed, 26 Aug 2009 01:21:00 GMT
I can never remember how to merge a Subversion branch into trunk. So for future reference, here is how it’s done.
First, get a working copy of the head revision of trunk.
svn checkout svn://svnserver/project/trunk projectNext, merge the branch with your working copy.
svn merge svn://svnserver/project/trunk svn://svnserver/project/branches/branch projectFinally, commit the results of the merge.
cd project
svn commit -m "Merging branch X.X.X into trunk."You can also specify a revision number in your merge.
svn merge svn://svnserver/project/trunk@223 svn://svnserver/project/branches/branch@223 projectThat’s it.
- Posted in Code Snippets
- Meta 3 comments, permalink, rss, atom
Comments
6 months later:
Once you have trunk checked out do we need to specify the trunk URL in the merge command, can we just say "svn merge svn://svnserver/project/branches/branch/project". When we merge trunk into a branch it works without specifying the target (branch) as branch is checked out?
6 months later:
Looks like this is only good if the trunk hasn't changed since you created the branch. If the is not the case, recent changes to the trunk will be reverted!
6 months later:
Joel - Yes, you should probably perform an update on a previously checked out trunk. I'll add that to this post.

