与Git和KDiff3进行三方比较 [英] Doing a three-way compare with Git and KDiff3

查看:132
本文介绍了与Git和KDiff3进行三方比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以设置Git以便我可以在KDiff3中使用三向比较?



我有两个分支,合并它们,我只需要检查每个合并点,我认为最好的办法是查看我想从其他分支进行更改的分支并说

  git difftool HEAD_OF_OTHER_BRANCH  - 。 

然后选择KDiff3中的合并文件。在完成我刚刚提交的文件之后。

我已经将merge.conflictstyle和diff.conflictstyle设置为diff3,但KDiff3仍然以双向比较开始。这可能吗?我猜如果Git也将共同祖先的哈希值作为参数发送出去,这是可能的,但这样做吗?



,但是我还是使用了我可以使用超越比较Git和KDiff3找不到任何东西。

似乎git diff只做一个2-way diff感觉生成补丁等),除了在合并状态,你必须做一个合并。前几天我遇到了类似的情况,我最终使用了我们的策略。这有效,但并不理想。也许我们需要一个无法解决的合并策略,而不是试图解决任何冲突。您可以通过调整.git / MERGE_ *文件并将所有文件设置为冲突来模拟。

否则,显而易见的解决方案是签出3个不同的目录并运行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.

解决方案

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

这篇关于与Git和KDiff3进行三方比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆