Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
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 

Syntax:

$ 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

Note: 

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

For more information refer man page for git-show

https://git-scm.com/docs/git-show

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94k users

Browse Categories

...