Search code examples
gitgit-diffmeld

git diff :: overriding .gitconfig external tool


I've configured git to use meld as an external diff tool:

$ cat ~/.gitconfig | grep -A2 "\[diff\]"
[diff]
        tool = vimdiff
        external = git-meld

... where git-meld is:

$ cat $(which git-meld)
#!/bin/bash
meld $2 $5

However sometimes (e.g. in the case of very minor diffs or if I want to easily copy-paste something from the diff text) I just want to see the differences on the shell and avoid meld's spawning delay.

Is there a way (e.g. a command line argument) to override the .gitconfig settings and instruct git to just do a simple text-only diff?


Solution

  • For your general question: pretty much all options can be overridden on the command line using -c:

    -c <name>=<value>

    Pass a configuration parameter to the command. The value given will override values from configuration files. The <name> is expected in the same format as listed by git config (subkeys separated by dots).

    That said, diff.external is a problem. You can change its value, but there is no way to unset it on the command line (that I can see). However, git diff does have a custom option to ignore the diff.external setting: you can use

    git diff --no-ext-diff