Git (Version Control) - View file content using the git show command
                
            
            
            
            
            
            
                           
                
            
            
            
                
    
    
    
            
                
                    by
                    Jeremy Canfield  |  
                    Updated: June 27 2023
                    
                          |  Git (Version Control) articles
                    
                    
                    
                
            
            The git show command can be used to view the content of a file at a particular commit. For example, the git log can be used to get the ID of each commit.
~]# git log --oneline example.txt
afba75a second commit
741785c first commit
And then the git show command can be used to view the content of the file at a particular commit.
git show <commit id>:<path/to/file>
For example.
git show afba75a:path/to/example.txt
Did you find this article helpful?
If so, consider buying me a coffee over at 