Alpha
Alpha

Reputation: 14086

List files modified for particular git commit

I have commit, abc, and I want to list files that were modified for the commit.

What is the git command which will list modified files for that commit?

Upvotes: 76

Views: 86268

Answers (3)

Alphapico
Alphapico

Reputation: 3041

For anyone who'd like to have an output summary like this for particular commit

enter image description here

Step

  1. Open your ~/.gitconfig file

  2. add this script under [alias]:

    swt = show --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --numstat

  3. Save ~/.gitconfig file

  4. Simply run git swt <commit-hash>

Upvotes: 3

Greg Bacon
Greg Bacon

Reputation: 139711

For filenames only:

git show --name-only abc

To see a summary of what happened to them:

git show --name-status abc

Upvotes: 106

shantanusinghal
shantanusinghal

Reputation: 724

You can see the files changed in a particular commit as follows

git show --stat <commit-hash>

Alternatively you can also view the patch introduced with each commit using the -p flag

git log -p <commit-hash>

BTW git show takes the same formatting arguments as git diff-tree, here's the documentation for diff-tree.

Upvotes: 35

Related Questions