Let’s say you’ve got a project in a Subversion repository, and you’ve created a branch of trunk
, in branches/newfeature
. You’ve been merging changes from trunk
to branches/newfeature
for awhile, but now you’re done with that work and you’re ready to move all of the changes in the branch back to the trunk. What’s the best way to do this?
You can follow the directions in the Subversion book, but that leads to a huge number of conflicts. Is there a cleaner way? If you’ve merged everything from the trunk into the branch, then what you really need is to just move the latest stuff in the branch into the trunk, without worrying about conflicts at all.
November 17, 2006 at 11:26 am
Assuming you’ve merged every revision from the trunk into the branch already, a merge of the differences between the trunk and the branch back to the trunk should work. In a clean working copy checked out from the trunk, do something like:
and then commit.
Or you can do what I did when this came up, and just delete the trunk and copy the branch in its place.
January 16, 2008 at 11:00 am
But what if you have not been merging changes from the trunk into the branch? This is still new to me. I have a branch that’s about 2 months old which has has no updates either to, or from, the trunk.
So I have many changes which need to be merged from the branch into the trunk. I’m using Subversion from within Eclipse.
January 16, 2008 at 11:29 am
I would strongly recommend using the svnmerge script and initializing it at the point where you created the branch. Then you can use it to merge in both directions:
http://www.orcaware.com/svn/wiki/Svnmerge.py