合并问题:我应该选择从哪个版本进行合并?

发布于 2024-11-27 09:59:30 字数 740 浏览 3 评论 0原文

我以前只遇到过简单的场景,即从主干分支,进行一些更改,然后将更改合并到主干中。但这一次它变得更加复杂,因为分支必须一路合并来自主干的新内容,现在我不知道应该从哪个版本开始从分支到主干的合并。见下图。

从主干合并到分支,然后再返回主干

这张图片应该描绘一个场景,其中 mybranch 是在修订版 10 中创建的。进行了很多更改,然后在修订版 25 中,我将一些新功能从主干合并到 mybranch 中,以创建一些新内容。修订版 30 中也是如此。进行了进一步的更改,然后我尝试合并,但遇到了很多冲突,并且出于某种原因,我认为将 trunk 中的新内容合并到 mybranch,然后再次尝试将 mybranch 中的更改合并回 trunk 中。但这就是我迷失的地方 - 我应该指定哪个修订版作为合并的起点?

如果我没有包含来自主干的任何更改,那会很容易:

svn merge -r11:HEAD http://repos.com/mybranch .

但是现在(在修订版 35 中) ),除了所有其他更改之外,mybranch 基本上还具有 /trunk 中的所有新更改。我应该怎么做才能将两者合并到/trunk中?

I have previously only had simple scenarios where I have branched from trunk, made some changes and then merged the changes into trunk. But this time it has gotten somewhat more complicated as the branch has had to merge in new stuff from trunk along the way, and now I do not know from which revision I am supposed to start the merge from branch to trunk. See picture below.

Merging from trunk to branch and then later back in trunk

The picture is supposed to depict a scenerio where mybranch is created in revision 10. A lot of changes are made, and then in revision 25 I merged some new features from the trunk into mybranch in order to create some new stuff. Ditto in revision 30. Further changes were made and I then tried to merge, but got a lot of conflicts, and for some reason I thought it might be easier to merge the new stuff from trunk into mybranch before trying to merge the changes in mybranch back into trunk again. But this is where I am lost - what revision should I specify as the starting point for the merge?

If I had not included any changes from the trunk it would have been easy:

svn merge -r11:HEAD http://repos.com/mybranch .

But now (in revision 35), mybranch basically has every new change in /trunk in addition to all the other changes. What should I do to merge the two into /trunk?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

早乙女 2024-12-04 09:59:30

您应该检查一个干净、新鲜的主干并与 --integrate 合并

merge --reintegrate <branch url>

有关更多详细信息和讨论,请参阅在线颠覆书籍:http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.branchemerge.basicmerging.reintegrate

尝试这个非常安全,因为你的存储库,直到您进行提交,如果您不喜欢合并的进行方式,您将有机会退出。

编辑:我应该更明确地说明,在这种情况下,您从分支的 HEAD 合并到主干的 HEAD。

You should check out a clean, fresh trunk and merge with --integrate

merge --reintegrate <branch url>

For a lot more detail and discussion see the subversion book on line: http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.branchemerge.basicmerging.reintegrate

It's pretty safe to try this since nothing happens to your repository until you do a commit, giving you a chance to backout if you don't like how the merge goes.

EDIT: I should have stated more explicitly that in this case you merge from the HEAD of your branch to the HEAD of your trunk.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文