How to view an old revision?

4 messages, 2 authors, 2016-08-11 · open the first message on its own page

How to view an old revision?

From: Matt McCutchen <hidden>
Date: 2016-08-11 20:13:06

Dear git people,

How do I view an old revision of a file without actually checking it
out?  This would be analogous to "cvs checkout -r <old> -p".  I've
RTMed and STWed and can't seem to find a way.

Re: How to view an old revision?

From: Matt McCutchen <hidden>
Date: 2016-08-11 19:29:45

On 11/1/06, Andy Whitcroft [off-list ref] wrote:
        git cat-file -p <commit-ish>:<file>
Nice!  Thanks!  I had guessed "git cat-file -p <commit-ish>/<file>"
but didn't try a colon as the separator.  The colon syntax ought to be
mentioned in the git-cat-file man page.

Re: How to view an old revision?

From: Andy Whitcroft <hidden>
Date: 2016-08-11 20:04:54

Matt McCutchen wrote:
Dear git people,

How do I view an old revision of a file without actually checking it
out?  This would be analogous to "cvs checkout -r <old> -p".  I've
RTMed and STWed and can't seem to find a way.
Something like the following:

	git cat-file -p <commit-ish>:<file>

For example:
	git cat-file -p tags/v1.4.3:git.c
	git cat-file -p f5f75c652b9c2347522159a87297820103e593e4:git.c

Re: How to view an old revision?

From: Andy Whitcroft <hidden>
Date: 2016-08-11 20:14:07

Matt McCutchen wrote:
On 11/1/06, Andy Whitcroft [off-list ref] wrote:
quoted
        git cat-file -p <commit-ish>:<file>
Nice!  Thanks!  I had guessed "git cat-file -p <commit-ish>/<file>"
but didn't try a colon as the separator.  The colon syntax ought to be
mentioned in the git-cat-file man page.
There are some improvements in the documentation in 'next' but nothing
which would make this easier for you to find.

Junio, I wonder if we should be changing the usage for this command
slightly.  Currently, it mearly says <object> as the identifier for the
blob.  Really this is <object-ish> as it supports symbolic naming in
addition to raw sha1's.  I also feel it would be very helpful if
<commit-ish> and family were documented as a glossary section in main
git manpage.

Something like this:

<commit-ish>:: is an sha1 for a commit, or any symbolic name for a
commit (see SPECIFYING REVISIONS in git-rev-parse)

What do people think.  I can do the munging about if its seems like a
sane plan.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help