I like the output formatting of git diff
. The color and the +
/-
representation of changes between lines is easier to read than GNU diff.
I can run git diff
using --no-index
flag outside of a git repo and it works fine. However, it appears to be missing the --exclude
option for excluding files or subdirectories from a recursive diff
.
Is there a way to get the best of both worlds? (color options and +
/-
format of git diff
and --exclude
option of GNU diff).
I've experimented with colordiff
, but I still prefer the output format of git diff
This will do the +/-
rather than <
and >
.
diff -u file1 file2
Since GNU diffutils 3.4 the flag --color
has been added. Combining both makes the following:
diff --color -u file1 file2
The flag --color
also takes an argument, valid options are never
, always
, or auto
. Useful when you want to be more explicit on what needs to be done.