svn - 为什么在将分支合并到主干然后将其合并回分支时会发生冲突?

标签 svn tortoisesvn merge branch conflict

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

我的步骤是:

  • 将 Trunk 中的最新更改合并到分支/BigFeature。 (Tortoise SVN -> 合并一系列修订版)
  • 将分支/BigFeature 中的更改合并到 Trunk。 (Tortoise SVN -> 重新整合一个分支)
  • 对 Trunk 进行一些更改。
  • 将 Trunk 中的更改合并到分支/BigFeatures。 (Tortoise SVN -> 合并一系列修订版)

  • 问题出现在第 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/

    相关文章:

    r - 在 R 中合并多个表

    python - Pandas 使用 dfA 列合并 == dfB 索引

    apache - SVN checkout 失败并显示 “chunk delimiter was invalid”

    svn - 是否有自动 SVN->GIT 同步服务?

    svn - 颠覆: How to find the differences between two tags?

    windows - TortoiseSVN 提交后 Hook 在 Win 7 上失败

    svn - 改了的文件没有被修改吗?

    windows - 乌龟 svn 存储库和 visual svn 存储库有什么区别?

    windows - 如何将本地文件替换为 SVN 存储库中的版本?

    performance - ssis - 合并连接替代方案