What is causing `diff` to run `git diff`?

This seems to be from prezto defining a function overriding diff. It may well have a way of disabling that, but I don't know what it is (but ericbn does!). You have a few options:

  • /usr/bin/diff or command diff will both run the diff command, rather than the function.
  • unset -f diff will remove the diff function. You could put that in your shell configuration.
  • As you've found, if colordiff is installed it will be used in preference to git diff by the function.
  • Finally, you can remove or rename the function from that file itself.

This really seems like a misfeature in prezto.


I would use an function like this

$ diffit () {
command diff "$@"
}

A function over an alias as there are parameters

Usage: diffit file1 file2

You could put it in your .bashrc
Personally I keep my collection of functions in .bash_functions and in .bashrc I have

test -f ~/.bash_functions.sh && . $_