Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I added this in ~/.gitconfig:

    external = mvimdiff

    prompt = false

and made a 755 /bin/mvimdiff that:


mvim -d "$2" "$5"

in order to invoke MacVim as my git diff tool. But when I run command git diff in a git folder, it still output the result from normal diff to shell. No MacVim at all. I am sure that no .git/config overwrite the .gitconfig, and I have tried to restart my computer to refresh. Why doesn't the config work?

Thank you.

share|improve this question

migrated from Nov 16 '12 at 20:13

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted

You may be better off using git difftool to invoke an “interactive” diff tool. For example:

Adapt the built-in gvimdiff tool to mvim:

git config --global diff.tool gvimdiff
git config --global difftool.gvimdiff.path mvim

Or, configure mvimdiff from scratch:

git config --global diff.tool mvimdiff
git config --global difftool.mvimdiff.cmd 'mvim -f -d "$LOCAL" "$REMOTE"'

Then run git difftool to view the each differing file in MacVim.

If you really want git diff itself to use MacVim, then you can configure it like this (without any external script files):

git config diff.external 'd() { mvim -f -d "$2" "$5"; }; d'

Either way, you need to make sure that the appropriate mvim is in your PATH. Also, you will need to use the -f option (“do not fork”/“run in foreground”) because otherwise git diff will probably delete the temporary files before MacVim has had a chance to read them (at least one file from each invocation will be a temporary file).

share|improve this answer
Thank you sir! Prob solved. – Skyler Nov 18 '12 at 1:17
still doesn't work for me :(➜ ✗ git config --global diff.tool meld ✗ git config --global difftool.meld.cmd 'meld "$LOCAL" "$REMOTE"' ✗ git difftool env-context.xml diff --cc env-context.xml index 4f430b5,b7ab2ef..0000000.... – ihadanny May 13 '13 at 8:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .