如果主干的目录结构发生变化,如何将分支合并回主干?
历史如下:
- 从主创建分支。
- 更改主干上的目录结构。
- 将新文件添加到分支上的旧目录结构中。
通常的合并方法如下:
- 将主干更改合并到分支
- 将分支合并回主干
但是,在我的情况下,步骤 1 已经导致树冲突。
我怎样才能最好地完成这项任务?
PS: 可能的重复没有接受的答案。
The history goes as follows:
- Create branch from main.
- Change directory structure on trunk.
- Add new files to the old directory structure on the branch.
The usual approach for merging goes as follows:
- Merge trunk changes to branch
- Merge branch back to trunk
However, in my situation step 1 will already result in tree conflicts.
How can I best deal with this task?
Ps: Possible duplicate has no accepted answers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先将所有主干更改合并到您的分支中,解决冲突。这很可能与您对主干所做的更改发生冲突,但如果您想合并对不同分支所做的更改,您最终将必须解决这些冲突,而这就是执行此操作的地方。
然后将分支重新整合到主干中。 (请注意,一旦重新集成,该分支就不适合进一步合并。最好的方法是删除它。)
为了减轻过多冲突堆积带来的痛苦,您可以做的一件事是逐步合并更改,而不是而不是一次将它们全部合并。有时,我发现当没有那么多更改时,更容易理解我正在合并的更改。理解这些变化可能是成功合并冲突的最重要方面。
First merge all trunk changes into your branch, resolving conflicts. This will very likely conflict with the changes you have made to the trunk, but if you want to merge those changes made to different branches, you ultimately will have to resolve those conflicts, and this is the place to do that.
Then reintegrate the branch into the trunk. (Note that the branch is not fit for further merges once it's reintegrated. The best is to delete it.)
One thing you can do to lessen the pain of having too many conflicts piling up is to merge changes step-by-step, rather than merging them all at once. I sometimes find it easier to understand the changes I am merging when there aren't so many of them. And understanding the changes might be the most important aspect of successfully merging conflicts.
您应该定期将主干合并到分支中(当然是在结构更改之后),并在分支完成后使用重新集成选项使主干与分支代码保持同步
you should be merging trunk into branch regularly (certainly after the structure change) and use the reintegrate option to bring trunk up to date with the branch code once the branch is finished with