找到你要的答案

Q:Why does git difftool use git diff instead?

Q:为什么Git difftool使用git diff做的吗?

I want git diff to be a quick command line solution to see the difference between two files, and then I want git difftool to launch meld for a more graphical view of the file differences.

Currently, git diff does exactly what I want it to, however when I run git difftool script.js, git tries to launch vimdiff instead of meld:

Viewing (1/1): 'script.js'
Launch 'vimdiff' [Y/n]:

If I specify the tool with git difftool -t meld script.js it tries to launch meld as it should:

Viewing (1/1): 'script.js'
Launch 'meld' [Y/n]:

How do I get git difftool <filename> to launch meld while git diff <filename> still uses vimdiff?


My .gitconfig contains the following:

[diff]
     tool = vimdiff
[difftool]
    tool = meld
[difftool "meld"]
    path = C:\\Program Files (x86)\\Meld\\Meld.exe

我想要的是一个快速的git diff命令行解决看看两个文件之间的差异,然后我想Git difftool推出MELD文件的差异更多的图形视图。

目前,git diff不正是我想要的,但是当我运行git difftool script.js,Git试图推出vimdiff代替MELD:

Viewing (1/1): 'script.js'
Launch 'vimdiff' [Y/n]:

如果我指定工具git difftool T MELD script.js试图推出融合应该:

Viewing (1/1): 'script.js'
Launch 'meld' [Y/n]:

我如何获得Git difftool <;filename>;推出融合而git diff <;filename>;仍然采用vimdiff?


My .gitconfig contains the following:

[diff]
     tool = vimdiff
[difftool]
    tool = meld
[difftool "meld"]
    path = C:\\Program Files (x86)\\Meld\\Meld.exe
answer1: 回答1:
git config --global diff.tool meld

This will set the default difftool to meld. I.e. when you invoke git difftool without the --tool parameter, git will run meld.

You can also remove that part of your config, git won't read difftool.tool as it's not one of git's known config options:

[difftool]
    tool = meld
git config --global diff.tool meld

这将设置默认difftool融合。即当你调用git difftool没有--刀具参数,Git将MELD。

您也可以删除您的配置的一部分,Git不会读difftool.tool因为它不是一个Git的配置选项:

[difftool]
    tool = meld
git  diff  config  vimdiff  meld