与 Git 和 KDiff3 进行三向比较

发布于 2024-09-17 09:04:56 字数 524 浏览 6 评论 0原文

是否可以设置 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 技术交流群。

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

发布评论

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

评论(2

深居我梦 2024-09-24 09:04:56

在命令行上运行:

git config --global mergetool.kdiff3.path /path/for/your/kdiff3/binary  

然后,在解决冲突时,您只需执行以下操作:

git mergetool --tool=kdiff3

Run this on the command line:

git config --global mergetool.kdiff3.path /path/for/your/kdiff3/binary  

Then, when solving conflicts you just have to do:

git mergetool --tool=kdiff3
星星的軌跡 2024-09-24 09:04:56

看起来 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

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