4

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
helmbert
  • 35,797
  • 13
  • 82
  • 95
Zach Olivare
  • 3,805
  • 3
  • 32
  • 45

1 Answers1

3
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
Alexander Groß
  • 10,200
  • 1
  • 30
  • 33
  • 1
    Perfect, that did the trick, thank you! But I don't quite understand what happened. That command changed `[diff] tool=vimdiff` to `[diff] tool=meld`. How does git know to use vimdiff for `git diff` when vimdiff is no longer specified anywhere in the .gitconfig? – Zach Olivare May 03 '15 at 20:19
  • 1
    Diff doesn't use vimdiff. AFAIK, git diff implements its own diff algorithm/way of displaying diffs in a shell. – Alexander Groß May 03 '15 at 20:22