How to list files that are changed in specific commit and get content of that files when I have sha number of commit ?
            Asked
            
        
        
            Active
            
        
            Viewed 5,801 times
        
    1 Answers
19
            To list the files that were changed by a particular commit, you can do:
git show --name-only <commit>
If you want to suppress the log message from that output, you can add --pretty=format: to the options.
As for your second question, to see the content of a particular file from that commit, say with SHA1sum f414f31, you can do:
git show f414f31:Documentation/help.txt
... where the path Documentation/help.txt is relative to the top level of the working tree, regardless of whether you're in a subdirectory or not.  If you need to extract a whole subdirectory, have a look at this question and answer:
 
    
    
        Community
        
- 1
- 1
 
    
    
        Mark Longair
        
- 446,582
- 72
- 411
- 327
