为什么在将分支合并到Trunk然后将其合并回分支时会出现冲突?

时间:2010-06-07 21:51:33

标签: svn tortoisesvn merge branch conflict

假设我有一个名为“branches / BigFeature”的功能分支。我想将这些更改推送到Trunk,对Trunk进行一些更改并将其全部合并回“BigFeature”分支,以便继续开发。

我的步骤是:

  1. 将Trunk中的最新更改合并到branches / BigFeature。 (Tortoise SVN - >合并一系列修订版)

  2. 将branches / BigFeature中的更改合并到Trunk。 (Tortoise SVN - >重新整合分支)

  3. 对Trunk进行一些更改。

  4. 将Trunk中的更改合并到branches / BigFeatures。 (Tortoise SVN - >合并一系列修订版)

  5. 问题出现在第4步。当我合并回BigFeature时,我遇到了各种各样的冲突。最初在branches / BigFeature中添加但合并到Trunk的文件似乎有问题。

      

    它给我的信息是“最后一个   合并操作尝试添加该文件   'blah',但已经添加了   本地。

    这种方式很有意义,因为该文件最初是在branches / BigFeature分支中添加的,然后合并到Trunk。但为什么合并操作不能实现呢?为什么会出现冲突?

    删除的文件会发生同样的错误。

      

    最后一次合并操作试图删除/移动/重命名目录'blah',但它已在本地删除,移动或重命名。

    谢谢你的帮助。

1 个答案:

答案 0 :(得分:7)

不幸的是,它是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