假设我有一个名为“branches/BigFeature”的功能分支。我想将这些更改推送到 Trunk,对 Trunk 进行一些更改并将其全部合并回“BigFeature”分支,以便继续开发。
我的步骤是:
问题出现在第 4 步。当我合并回 BigFeature 时,我遇到了各种冲突。最初添加在分支/BigFeature 中但合并到主干的文件似乎有问题。
The message it gives me is "The last merge operation tried to add the file 'blah' but it was already added locally.
这有点道理,因为该文件最初是添加到分支/BigFeature 分支中,然后合并到 Trunk。但是合并操作为什么不能实现这一点呢?为什么会出现冲突?
删除的文件也会发生同样的错误。
The last merge operation tried to delete/move/rename the directory 'blah', but it was deleted, moved or renamed locally.
谢谢你的帮助。
最佳答案
不幸的是,它是 svn 的一个缺陷,它的构建方式。
svn 中的步骤必须如下所示:
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 分支不再可用。
更新:有一个 second way , 而不是删除分支。
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."
我不知道这个技巧,多亏了你的问题,我才学会了:D
关于svn - 为什么在将分支合并到主干然后将其合并回分支时会发生冲突?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2993447/