Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (29.3k points)

Is there a command in Git to see (either dumped to stdout or in $PAGER or $EDITOR) a particular version of a particular file?

1 Answer

0 votes
by (50.2k points)

The quickest way to see the revisions is through git show 


$ git show REVISION:path/to/file

Replace revision with your actual revision

For example: 

If suppose you need to see the revision of 2 commits ago.

$ git show HEAD~2:src/main.c


The Path is from the root repository should start with either ./ or ../ 

For more information refer man page for git-show

Browse Categories