11

How to list files that are changed in specific commit and get content of that files when I have sha number of commit ?

1

1 Answer 1

19

To list the files that were changed by a particular commit, you can do:

git show --name-only <commit>

If you want to suppress the log message from that output, you can add --pretty=format: to the options.

As for your second question, to see the content of a particular file from that commit, say with SHA1sum f414f31, you can do:

git show f414f31:Documentation/help.txt

... where the path Documentation/help.txt is relative to the top level of the working tree, regardless of whether you're in a subdirectory or not. If you need to extract a whole subdirectory, have a look at this question and answer:

Not the answer you're looking for? Browse other questions tagged or ask your own question.