Why do I get conflicts when Merging a branch to the Trunk and then merging it back to the branch?
Lets say I have a feature branch named "branches/BigFeature". I want to push those changes to the Trunk, make som开发者_JAVA技巧e changes to Trunk and merge back it all back into the "BigFeature" branch so development can continue.
My steps were to:
Merge the latest changes in Trunk to branches/BigFeature. (Tortoise SVN -> Merge a range of revisions)
Merge the changes in branches/BigFeature to Trunk. (Tortoise SVN -> Reintegrate a branch)
Make some changes to Trunk.
Merge the changes in Trunk to branches/BigFeatures. (Tortoise SVN -> Merge a range of revisions)
The problem arises in step 4. When I merge back to BigFeature I get all kinds of conflicts. It seems to have a problem with files that were originally added in branches/BigFeature but were merged to the Trunk.
The message it gives me is "The last merge operation tried to add the file 'blah' but it was already added locally.
This kinda makes sense because the file was originally added in the branches/BigFeature branch and then merged to Trunk. But why can't the merge operation realize this? Why is it coming up as a conflict?
The same kind of error happens for deleted files.
The last merge operation tried to delete/move/rename the directory 'blah', but it was deleted, moved or renamed locally.
Thanks for you help.
Unfortunately it is a deficiency of svn, the way it is built.
The steps in svn must look like this:
1. (not modified) Merge the latest changes in Trunk to branches/BigFeature. (Tortoise SVN -> Merge a range of revisions)
2. (not modified) Merge the changes in branches/BigFeature to Trunk. (Tortoise SVN -> Reintegrate a branch)
2a. Delete branch branches/BigFeature
2b. Create branch branches/BigFeature from current trunk
3. (not modified) Make some changes to Trunk.
4. (not modified) Merge the changes in Trunk to branches/BigFeatures. (Tortoise SVN -> Merge a range of revisions)
SVN branch is no longer usable after a reintegrate operation.
Update: there is a second way, instead of deleting the branch.
2a. on branch:
$ svn update
Updated to revision X
$ svn merge --record-only -c X ^/trunk
$ svn commit -m "Block revision X from being merged into the branch."
I did not know this trick, I learned it thanks to your question :D
精彩评论