I need a list of files that had changed content between two commits (only added or modified), so I used:
git diff --name-only --diff-filter=AM <commit hash #1> <commit hash #2>
The different diff-filter options from the git diff documentation:
diff-filter=[(A|C|D|M|R|T|U|X|B)…?[*]]
Select only files that are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (i.e. regular file, symlink, submodule, …?) changed (T), are Unmerged (U), are Unknown (X), or have had their pairing Broken (B). Any combination of the filter characters (including none) can be used. When * (All-or-none) is added to the combination, all paths are selected if there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing is selected.
Also, these upper-case letters can be downcased to exclude. E.g. --diff-filter=ad excludes added and deleted paths.
If you want to list the status as well (e.g. A / M), change --name-only
to --name-status
.