I prefer git’s diff output over plain diff: colors, word diffs, moved code. With one option it works on any two files on disk.
git diff --no-index old.conf new.conf
Outside a repository, git switches to this mode by itself, but inside one you need --no-index, or git thinks you mean tracked files. You can compare two folders the same way, and all the usual options apply:
git diff --no-index --word-diff nginx.conf.bak nginx.conf
git diff --no-index --stat backup/ site/
I’d reach for this to compare a config file with its backup copy, or two exports of the same thing. A long line where only one value changed is much easier to read with --word-diff than with the line-based output of plain diff.
In a script, mind the exit code. With --no-index, git exits with 1 when the files differ and 0 when they’re the same, just like diff, so a set -e script stops at the first difference.
Further reading: git-diff documentation