How to use different merge and diff tool in git?

对着背影说爱祢 提交于 2019-12-09 23:45:19

问题


I prefer to use meld as the diff tool. However it doesn't have an option to quickly solve all simple conflicts so in case of merging I'd like to use kdiff3

I've set merge.tool to kdiff3 and diff.guitool to meld but git difftool still always run kdiff3

[merge]
        tool = kdiff3
        conflictstyle = diff3

[diff]
        guitool = meld
        renames = copies
        mnemonicPrefix = true

[difftool]
        prompt = false

How to make git difftool run meld?


回答1:


diff.guitool only applies if you use the --gui flag.

Setting diff.tool and merge.tool should make git difftool and git mergetool use different tools:

[merge]
        tool = kdiff3

[diff]
        tool = meld



回答2:


Note: since Git 2.22 (Q2 2019), the combinations of {diff,merge}.{tool,guitool} configuration variables serve as fallback settings of each other in a sensible order.

See commit 6c22d71, commit 7f978d7, commit 60aced3, commit 884630b, commit 05fb872 (29 Apr 2019), and commit 57d93c1, commit e9d309e (24 Apr 2019) by Denton Liu (Denton-L).
(Merged by Junio C Hamano -- gitster -- in commit 85ac27e, 19 May 2019)

In your case, since difftool is not defined:

difftool: fallback on merge.guitool

In git-difftool.txt, it says

'git difftool' falls back to 'git mergetool' config variables when the difftool equivalents have not been defined.

However, when diff.guitool is missing, it doesn't fallback to anything. Make git-difftool fallback to merge.guitool when diff.guitool is missing.

The documentation now includes:

git difftool -g/--gui

When 'git difftool' is invoked with the -g or --gui option, the default diff tool will be read from the configured diff.guitool variable instead of diff.tool.
The --no-gui option can be used to override this setting.

If diff.guitool is not set, we will fallback in the order of merge.guitool, diff.tool, merge.tool until a tool is found.



来源:https://stackoverflow.com/questions/46218164/how-to-use-different-merge-and-diff-tool-in-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!