I am looking for a simple git
command that provides a nicely formatted list of all files that were part of the commit given by a hash (SHA1), with no extraneous
I personally use the combination of --stat and --oneline with the show command:
git show --stat --oneline HEAD
git show --stat --oneline b24f5fb
git show --stat --oneline HEAD^^..HEAD
If you do not like/want the addition/removal stats, you can replace --stat with --name-only
git show --name-only --oneline HEAD
git show --name-only --oneline b24f5fb
git show --name-only --oneline HEAD^^..HEAD
Display the log.
COMMIT can be blank ("") or the sha-1 or the sha-1 shortened.
git log COMMIT -1 --name-only
This will list just the files, very useful for further processing.
git log COMMIT -1 --name-only --pretty=format:"" | grep "[^\s]"
OK, there are couple of ways to show all files in a particular commit...
To reduce the info and show only names of the files which committed, you simply can add --name-only
or --name-status
flag..., these flags just show you the file names which are different from previous commits as you want...
So you can do git diff
followed by --name-only
, with two commit hashes after <sha0> <sha1>
, something like below:
git diff --name-only 5f12f15 kag9f02
I also create the below image to show all steps to go through in these situation:
You can also do
git log --name-only
and you can browse through various commits, commit messages and the changed files.
Type q to get your prompt back.
$ git log 88ee8^..88ee8 --name-only --pretty="format:"
I use this to get list of modified files between two changesets:
git diff --name-status <SHA1> <SHA2> | cut -f2