简体   繁体   English

如何重新集成分支,覆盖尚未合并到分支的主干更改?

[英]How to reintegrate branch, overwriting trunk changes that has not been merged into branch?

We have worked on a feature branch the last six months. 在过去的六个月中,我们一直在功能分支上工作。 Most commits made to the trunk in this period have been merget to the branch, but some trunk commits were deliberately never merged to the branch. 在此期间,对主干所做的大多数提交都已合并到分支中,但是有意将某些主干提交从未合并到分支中。

Now the branch is complete, and we basically want to "replace" trunk with the branch (we do not need the trunk changes that was never merged to the branch anymore). 现在分支已经完成,我们基本上想用分支“替换”主干(我们不再需要不再合并到分支的主干更改)。 This answer to a simular question suggests : 对于一个类似问题的答案表明

  1. Check out the trunk revision from which you created the branch (not the HEAD revision). 签出创建分支的主干修订版(而不是HEAD修订版)。
  2. Commit it to the repository (this undoes all subsequent trunk changes). 将其提交到存储库(这将撤消所有随后的中继更改)。
  3. Do your reintegrate-merge (your trunk working copy should now be identical to the branch.) 重新合并(您的主干工作副本现在应该与分支相同)。
  4. Commit the merged trunk, and you're done! 提交合并的主干,您就完成了!

This answer suggests : 这个答案表明

svn co http://svnhost/trunk
cd trunk
svn merge http://svnhost/trunk http://svnhost/branches/branchname

What will be the proper solution in my case? 在我的情况下,什么是正确的解决方案?

If you really want to replace your trunk, then you could you use the Repository Browser (TortoiseSVN) and do the following: 如果您确实要更换中继线,则可以使用存储库浏览器(TortoiseSVN)并执行以下操作:

  • Delete the trunk 删除后备箱
  • Use "Copy To" to copy your branch to the "trunk" location 使用“复制到”将分支复制到“主干”位置
  • Delete the branch 删除分支

You could also move the branch to the repository root and rename it to "trunk". 您也可以将分支移动到存储库根目录并将其重命名为“ trunk”。

If you are using externals that point to your current trunk, you might have a problem if you did not use the "peg" revision when referencing the trunk. 如果使用指向当前中继线的外部设备,则在引用中继线时未使用“ peg”修订版,则可能会出现问题。 If you do not use externals, you should be fine. 如果您不使用外部设备,则应该没问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM