三路自动合并相对于两路的优点
我有兴趣了解源代码文件的双向和三向合并。根据我所读到的内容,与三向合并相比,双向合并有一些“严重的弱点”。我真正希望看到的是一两个简单、具体的例子,其中三向合并能够自动将某些内容从分支合并到主干而不产生冲突,而双向合并则失败并需要一堆手动干预来合并代码。
任何博客文章的链接甚至书籍的参考都将不胜感激(是的,我已经用谷歌搜索了一个小时左右)。谢谢!
I'm interested in understanding two-way and three-way merging of source code files. Based on what I've read, two-way merging has some "crippling weaknesses" compared to three-way merging. What I'd really like to see are one or two simple, concrete examples of cases where three-way merging is able to automatically merge something from a branch to the trunk without producing conflicts, while two-way merging falls down and requires a bunch of manual intervention to get the code merged.
Any links to blog posts or even references to books would be appreciated (yes, I have Googled this for an hour or so). Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您有一个文件,一个人向其中添加了一行,但另一个人从中删除了一行,则两个更改版本之间的双向合并会告诉您它们是不同的,但不会告诉您如何“协调”更改;差异将在其中一个文件中显示另外两行,因此如果您不知道更改是什么,则可能不清楚合并应该是什么。
另一方面,三向合并清楚地表明删除了一行并添加了一行。当您可以看到文件的两个版本与其共同祖先的差异时,就没有任何歧义了。
If you have a file and one person adds a line to it but another person removes a line from it, two way merging between the two changed versions will tell you that they're different but not what to do to "reconcile" the changes; the diff will show two additional lines in one of the files so if you don't know what the changes were it may not be clear what the merge should be.
Three way merging, on the other hand, clearly indicates that one line was removed and one was added. There's no ambiguity when you can see both versions of the file's differences from their common ancestor.