与 Git 和 KDiff3 进行三向比较
是否可以设置 Git,以便我可以在 KDiff3 中使用三向比较?
我有两个分支差异太大,无法自动合并它们,我只需检查每个合并点,我认为最好的方法是检查我想要从另一个分支进行更改的分支,
git difftool HEAD_OF_OTHER_BRANCH -- .
然后选择“合并” KDiff3 中的文件。在浏览完这些文件后,我就提交了。
我已经将 merge.conflictstyle 和 diff.conflictstyle 设置为 diff3 但 KDiff3 仍然以双向 diff 开始。这可能吗?我想如果 Git 也发送共同祖先的哈希值作为参数,这是可能的,但是真的吗?
有讨论 关于如何使用 SVN 和 BC3 执行此操作,但我找不到 Git 和 KDiff3 的任何内容。
Is it possible to set Git up so that I can use the three-way compare in KDiff3?
I have two branches that are far too different to auto-merge them, I simply have to check each merge point and I think the best way would be to check out the branch I want the changes from the other branch and say
git difftool HEAD_OF_OTHER_BRANCH -- .
And then select Merge File in KDiff3. After having gone through the files I'd just commit.
I have set up merge.conflictstyle and diff.conflictstyle to diff3 but KDiff3 still starts with a two-way diff. Is this possible? I guess if Git also sends the common ancestor's hash as a parameter, this is possible, but does it?
There is discussion about how to do this with SVN and BC3, but I couldn't find anything for Git and KDiff3.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在命令行上运行:
然后,在解决冲突时,您只需执行以下操作:
Run this on the command line:
Then, when solving conflicts you just have to do:
看起来 git diff 只做 2 路 diff (这对于生成补丁等有意义),除了在合并状态下,你必须为此进行合并。前几天我也遇到了类似的情况,最终我使用
我们的
策略进行了合并。这有效,但并不理想。也许我们需要一个“非解决”合并策略,它不会尝试解决任何冲突。您也许可以通过调整 .git/MERGE_* 文件并将所有文件设置为冲突来模拟这一点。否则,明显的解决方案是签出 3 个不同的目录并运行 kdiff3 ,但我猜您正在寻找更优雅的解决方案
It seems that git diff do only a 2-way diff (which make sense to generate patch etc) except in a merging state , you have to do a merge for that. I was in a similar situation the other day and I ended up mergin using the
ours
strategy. That worked but wasn't ideal. Maybe we need a 'nonresolve' merging strategy which doesn't try to resolve any conflicts. You might be able to emulate that by tweaking the .git/MERGE_* files and set all the files as conflicted.Otherwise the obvious solution is to checkout 3 different directory and run kdiff3 , but I guess you are looking for a more elegant solution