git 的合并冲突解决是否比其他 SCM 和合并工具更有效?
git
的合并冲突解决本质上比其他 SCM(CVS、Subversion 等)以及独立的合并工具更有效吗?如果是这样,为什么?
澄清:这里我对算法本身更感兴趣 - 它与普通的 diff3 方法有什么不同吗?
有些工具声称在这方面更聪明(例如 Guiffy),是否值得插入一个作为 git 合并工具? git 在找出文件内或文件间移动的文本片段方面是否更聪明? (而不是报告吵闹的冲突......我从莱纳斯的谈话中对此有一个模糊的印象)。
背景:刚刚使用 git-svn 进行了一次巨大的合并,这导致了比我使用普通 svn merge 得到的冲突一半(第一次合并没有跟踪)..所以我'我想了解为什么。
这些问题/解答类似,但更多的是关于流程的整体情况,以及合并如何更自然地融入其中。为此,git“针对合并进行了优化”(而不是仅分支),它实际上意味着:
- 更少的手动冲突 - 更好的自动解决算法(例如,重命名处理得很好)
- 更安全操作 - 自动解决留下更多/只留下真正的冲突和更少的错误警报
- 更快的操作 - 例如,由于精益和优化意味着对象模型
- 更好的工具——这使得体验不那么痛苦,例如基于 DAG 的合并跟踪、mergetool、历史查询/可视化、stash、rebase 等...
- 还有
- 上述的组合
吗? 现在,我最感兴趣的是 1 & 2.
Is git
's merge conflict resolution inherently more efficient than other SCMs (CVS,Subversion,etc.), and also standalone merge tools? If so, why?
Clarification: here I'm more interested in the algorithm itself - is it any different from a plain diff3 method?
Some tools claim to be smarter in that(e.g. Guiffy), is it worth plugging one in as a git merge tool?
Is git any smarter in figuring out pieces of text moved within or across files ? (rather than reporting noisy conflicts.. I had a vague impression of that from Linus' talk).
Background: just did a huge merge using git-svn
which resulted in half the conflicts than I got with plain svn merge
(first merge with no tracking) .. so I'd like to understand why.
The are similar Qs/As around but they are more about the big picture of the process, and how merging fits in that more naturally. To that end, git
being 'optimised for merges' (as opposed to only branching), does it actually mean:
- less manual conflicts -- better auto-resolution algorithms (eg. renaming is handled nicely)
- safer operation -- auto-resolution leaves more/only real conflicts and less false alerts
- faster operation -- say, due to the lean & mean object model
- better tooling -- which makes the experience less painful, e.g. DAG-based merge tracking, mergetool, history query/visualisation, stash, rebase,etc...
- something else
- a combination of the above
?
Now, I'm mostly interested in 1 & 2.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我很想在这个答案上被证明是错误的,但是……来自于强制性……git 的这个领域还有些欠发达。
git 中不存在自动合并。最新版本具有使用您的更改或他们的更改执行合并的基本支持,但仅此而已。基本上,如果您编辑文件的一部分,而其他人编辑文件的同一部分……您就需要自己进行合并解析。 diff3 格式可用(3 路合并),但我相信统一的 diff 格式是标准。我实际上使用 araxis 作为合并工具,并将其设置为在运行“git mergetool”时使用 3 路合并。不过,来自 perforce...我觉得 git 在这个领域远远落后。
N/A
更新回复:评论
我还没有足够深入地了解 git 认为是冲突的内容以及 p4 认为是冲突的内容,但这是我在两者中所经历的。
我在这里的答案有点主观......但我非常怀念我与 perforce 的合并。
I would love to be proven wrong on this answer but... coming from perforce... this area of git is a bit under developed.
Auto merging in git is non-existant. The latest version has basic support for performing a merge using your changes or their changes but that's it. Basically if you edit a portion of a file and someone else edits the same portion of a file... you're on your own for merge resolution. The diff3 format is available (3-way merge) but I believe a unified diff format is the standard. I actually use araxis as the merge tool and have it setup to use 3 way merge when running "git mergetool". Coming from perforce though... I feel like git is way behind in this area.
N/A
Update RE: comments
I haven't dug deep enough into exactly what git thinks is a conflict and exactly what p4 thinks is a conflict but here's what I've experienced in both.
My answers here are a bit subjective... but I do sorely miss the merging that I had with perforce.
此外,这个更新thread (2012) 详细介绍了 Git 的“自动解析”概念:
Junio C Hamano 在回答中提出了一个重要的观点:
5 年半后,2018 年 5 月更新(Git 2.18,2018 年第 2 季度)
“
git mergetools
”学会了与 guiffy 交谈。请参阅 提交 6ceb658(2018 年 4 月 5 日),作者:比尔·里彻 (``)。
(由 Junio C Hamano --
gitster
-- 合并于 提交da36be5,2018年4月25日)In addition, this more recent thread (2012) details the notion of "auto-resolution" with Git:
Junio C Hamano raises in answer an important point:
Update 5 and a half years later, May 2018 (Git 2.18, Q2 2018)
"
git mergetools
" learned talking to guiffy.See commit 6ceb658 (05 Apr 2018) by Bill Ritcher (``).
(Merged by Junio C Hamano --
gitster
-- in commit da36be5, 25 Apr 2018)