on January 02, 2020. in Development, Software. A 1 minute read.
Yesterday I was looking at a rather large diff, but for the type of change I was after, I wanted to look only at the newly added files. Turns out, git diff has a filtering option with --diff-filter
.
The possible values for the --diff-filter
are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), type changed (T), Unmerged (U), Unknown (X), and some kind of a Broken (B) file(?).
Running git diff --diff-filter=A
will show the diff only for the added files.
These filtering options can also be provided with lowercase, in which case it will behave as an exclude filter. git diff --diff-filter=a
will show the diff for all files, except for added ones.
Happy hackin’ and a happy new year!
If you'd like, you can get the next article I write to your email inbox.