+2 votes
1 view
in Devops and Agile by (20k 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 (28.4k 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

0 votes
1 answer
asked Nov 4, 2019 in Devops and Agile by chandra (29k points)
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !