For unix, combining just git
and the built-in diff
:
git show HEAD:path/to/file | diff -y - path/to/file
Of course, you can replace HEAD with any other git reference, and you probably want to add something like -W 170
to the diff command.
This assumes that you are just comparing your directory contents with a past commit. Comparing between two commits is more complex. If your shell is bash
you can use "process substitution":
diff -y -W 170 <(git show REF1:path/to/file) <(git show REF2:path/to/file)
where REF1
and REF2
are git references – tags, branches or hashes.