How do I list all of the files in a commit?

Explanation

If you want to list all of the files in a commit then there are two ways of doing that. First way is as follows which is shown below:

$ git diff-tree --no-commit-id --name-only -r bd61ad98
index.html
javascript/application.js
javascript/ie6.js

Another Way of doing this is :

$ git show --pretty="" --name-only bd61ad98    
index.html
javascript/application.js
javascript/ie6.js

There are different arguments that can be helpful are shown below

  • The --no-commit-id suppresses the commit ID output.
  • The --pretty argument is use to specifies an empty/null format string to avoid the cruft at the beginning.
  • The --name-only argument shows only the file names that were affected. If you want to see what happen to each file at that time you can use --name-status instead,
  • The -r argument is use to recurse into sub-trees

 

Also read, How can I determine the URL that a local Git repository

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *