I created a branch (revision 9002) out of my trunk and have continued to make changes to it for a few weeks. I have also merged the changes from trunk into the branch regularly and without problems, using
svn merge -rXXXX:HEAD
where XXXX is the revision after the one that my previous merge created. So far so good.
I now have to merge the branch into the trunk and am having major difficulties doing so. I've tried following SVN: Merging a Branch into Trunk, but when using
svn merge -r9003:head http://path/to/my/branch
I get around 20 tree conflicts, followed by svn: Attempt to add tree conflict that alread开发者_开发问答y exists
, and the process halts.
Is this the correct way to do this? Any ideas?
The last thing I did on the branch was merging the trunk to it, so the branch is basically my new trunk.
If you've merged everything from trunk into your branch and just want to promote that to trunk then it's probably easiest to just move the directories in the repository
svn move http://path/to/trunk http://path/to/branches/old-trunk
svn move http://path/to/branches/my-new-trunk http://path/to/trunk
Note that since you've now copied into trunk then svn log --stop-on-copy
(the default in Tortoise) will stop at this point - you'll need to turn that flag off to see further back.
Otherwise I think you'll have to svn merge
as before, in small groups of revisions rather than in one go and resolve the various conflicts as you go.
I always use the --reintegrate
flag when I merge a branch back into trunk. So, when in the directory of a checked out copy of trunk, try svn merge --reintegrate ^/path/to/branch
. Also, I am not sure why you use svn merge -rXXXX:HEAD
rather than just svn merge ^/trunk
from the directory of a checked out copy of trunk. That is what I have always done, though I am frequently wrong :)
To merge your branch, you have to merge the difference of the branch and trunk (that is, a manual --reintegrate
).
So
svn merge http://path/to/trunk@N http://path/to/branch@HEAD .
where N
is the last revision of the trunk that you merged into the branch. Considering that the last thing you did was to synchronize the branch with the trunk you could use HEAD
.
In a manner of speaking you tell SVN to to merge all changes done in the branch excluding those that came from the trunk.
Also, when you want to synchronize your branch with the trunk, do svn merge http://path/to/trunk .
精彩评论