如何将分支合并回主分支并避免树冲突-TortoiseSVN [英] How to merge branch back to main branch and avoid tree conflicts - TortoiseSVN

查看:412
本文介绍了如何将分支合并回主分支并避免树冲突-TortoiseSVN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用TortoiseSVN在SVN中管理的源文件.我添加了文件并将其提交给修订版,随后决定分支.我分支了所需的文件,并在不打算使用的文件的主干上执行了删除操作.

I have source files managed in SVN using TortoiseSVN. I had added files and committed them to a revision, and subsequently decided to branch. I branched with the files I needed, and performed a delete on the trunk of the files that wasn't intended to be used.

现在,我正在尝试将分支重新集成到主干中. 使用乌龟,我已经从树干合并到分支的修订范围,从删除树干到头部.这使分支保持最新状态.

Now I'm attempting to reintegrate the branch to the main trunk. Using tortoise, I have merged from trunk to branch the range of revisions from AFTER the delete on the trunk to head. This brings the branch up to date.

现在,我切换到主干,并尝试将修订从分支合并到主干,并且合并指示新文件正在跳过"或删除了我现在已经完成的文件.

Now I switch to the trunk, and attempt to merge the revisions from the branch to the trunk, and the merge indicates new files being "skipped" or the deletion of my files which are now complete.

我在合并中是否缺少最新的行李箱信息?

Am I missing something on the merging to being the trunk up to date?

推荐答案

为了进行重新集成,您需要合并分支后的Trunk中发生的所有修订正在寻求重新整合.

In order to do a reintegration, you need to merge ALL revisions from Trunk that occurred after you branched into the branch you're looking to reintegrate.

下面是一个示例:

  • 上一版...
  • Rev 20 -( Trunk )提交新文件
  • Rev 21 -(功能分支)创建功能分支
  • Rev 22 -( Trunk )从 Rev 20
  • 中删除文件
  • Rev 23 -( Trunk )处理随机文件
  • Rev 24 -(功能分支)处理其他随机文件
  • 版本25 -(功能分支)将修订版本 22 23 合并到功能分支
  • Rev 26 -( Trunk )将功能分支重新集成到Trunk
  • Prev revs ...
  • Rev 20 - (Trunk) Commit new files
  • Rev 21 - (Feature Branch) Create feature branch
  • Rev 22 - (Trunk) Delete files from Rev 20
  • Rev 23 - (Trunk) Work on random files
  • Rev 24 - (Feature Branch) Work on other random files
  • Rev 25 - (Feature Branch) Merge revisions 22 and 23 into Feature Branch
  • Rev 26 - (Trunk) Reintegrate Feature Branch into Trunk

您会注意到,作为合并到功能分支( Rev 25 )的一部分,我们删除了文件( Rev 22 ).

You'll note that we included the deletion of your files (Rev 22) as part of the merge to Feature Branch (Rev 25).

Rev 25 期间合并来自Trunk的更改时,您希望包含在Feature Branch中的文件将被删除.关于Trunk中实际发生的情况,这是正确的.您将在此处有几种选择:

Your files that you desire to have in your Feature Branch will be deleted when you merge in changes from Trunk during Rev 25. This is true and accurate regarding what actually happened in the Trunk. You will have several options here:

  1. 如果在 Rev 24 中在Feature Branch中修改了在Trunk中删除的文件,则尝试按照 Rev 25 合并时会收到树冲突.强>.您只需在执行合并时使用本地更改将冲突标记为已解决即可.
  2. 执行 Rev 22 的仅记录合并到Feature Branch,然后随后执行任何其他必要的合并到Feature Branch(这应该与我在#1中提到的等同)
  3. 按照 Rev 25 将其合并到Feature Branch中.合并完成后,您可以查看Feature Branch的日志并还原在 Rev 25 中所做的更改(合并本身),该操作通过挑选文件并还原每个文件来删除文件.这些版本会将文件还原为新文件,以添加到Feature Branch的存储库中. 请注意,这些文件在历史记录中将与原始文件不同.就SVN而言,这些文件被视为全新文件,因此它们与原始文件没有任何渊源.
  4. .
  1. If the files that were deleted in Trunk were modified in Feature Branch during Rev 24, you'll receive a Tree Conflict when attempting to merge as per Rev 25. You can simply mark the conflict as resolved using your local changes when performing the merge.
  2. Perform a record-only merge of Rev 22 into Feature Branch and then subsequently perform any other merges necessary into Feature Branch (this should be equivalent to what I mentioned in #1)
  3. Perform the merge into Feature Branch as per Rev 25. When the merge is complete, you can view the log of Feature Branch and revert the changes made in Rev 25 (the merge itself) which deleted your files by cherry picking the files and reverting each one. These reversions will restore the files as new to be added to the repository of Feature Branch. Note that these files will NOT be the same in the history as the original files. These are considered brand new files as far as SVN is concerned so they do not share any ancestry with their original counterparts.

这篇关于如何将分支合并回主分支并避免树冲突-TortoiseSVN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆