How to list all the files in a commit?

后端 未结 30 2788
一个人的身影
一个人的身影 2020-11-22 01:50

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

30条回答
  •  独厮守ぢ
    2020-11-22 02:21

    There is a simple trick to view as a file listing, just add : after the hash.

    git show 9d3a52c474:
    

    You can then drill in,

    git show 9d3a52c474:someDir/someOtherDir
    

    If you hit a file you'll get the raw version of the file; which sometimes is what you want if you're only looking for a nice reference or key pieces of code (diffs can make everything a mess),

    git show 9d3a52c474:someDir/someOtherDir/somefile
    

    Only drawback of this method is that it doesn't easily show a tree of files.

提交回复
热议问题