How to list all the files in a commit?

后端 未结 30 2380
一个人的身影
一个人的身影 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's also git whatchanged, which is more low level than git log

    NAME
           git-whatchanged - Show logs with difference each commit introduces
    

    It outputs the commit summary with a list of files beneath it with their modes and if there added(A), deleted(D) or modified(M);

    $ git whatchanged f31a441398fb7834fde24c5b0c2974182a431363
    

    Would give something like:

    commit f31a441398fb7834fde24c5b0c2974182a431363
    Author: xx 
    Date:   Tue Sep 29 17:23:22 2015 +0200
    
        added fb skd and XLForm
    
    :000000 100644 0000000... 90a20d7... A  Pods/Bolts/Bolts/Common/BFCancellationToken.h
    :000000 100644 0000000... b5006d0... A  Pods/Bolts/Bolts/Common/BFCancellationToken.m
    :000000 100644 0000000... 3e7b711... A  Pods/Bolts/Bolts/Common/BFCancellationTokenRegistration.h
    :000000 100644 0000000... 9c8a7ae... A  Pods/Bolts/Bolts/Common/BFCancellationTokenRegistration.m
    :000000 100644 0000000... bd6e7a1... A  Pods/Bolts/Bolts/Common/BFCancellationTokenSource.h
    :000000 100644 0000000... 947f725... A  Pods/Bolts/Bolts/Common/BFCancellationTokenSource.m
    :000000 100644 0000000... cf7dcdf... A  Pods/Bolts/Bolts/Common/BFDefines.h
    :000000 100644 0000000... 02af9ba... A  Pods/Bolts/Bolts/Common/BFExecutor.h
    :000000 100644 0000000... 292e27c... A  Pods/Bolts/Bolts/Common/BFExecutor.m
    :000000 100644 0000000... 827071d... A  Pods/Bolts/Bolts/Common/BFTask.h
    ...
    

    I know this answer doesn't really match "with no extraneous information.", but I still think this list is more useful then just the filenames.

提交回复
热议问题