Back

Explore Courses Blog Tutorials Interview Questions
+2 votes
2 views
in DevOps and Agile by (19.4k points)
edited by

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 information.
I have tried:

git show a303aa90779efdd2f6b9d90693e2cbbbe4613c1d

Although it lists the files, it also includes unwanted diff information for each.
Is there another git command that will provide just the list I want, so that I can avoid parsing it from the git show output?

 

1 Answer

+1 vote
by (27.5k points)
edited by

Option A: 

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

Option B: 

In case you don't want to add or remove stats, replace --stat with --name-only

git show --name-only --oneline HEAD

git show --name-only --oneline b24f5fb

git show --name-only --oneline HEAD^^..HEAD

For more information please go through the following tutorial to get more info about git:

 

Related questions

Browse Categories

...