# Get a copy of an old version of a file, using git gui/gitk

2 messages from 2008-09-19 to 2008-09-19. Participants: Peter Krefting, Björn Steinbrink.
Thread: https://gitlist.dev/t/15586

## Peter Krefting, 2008-09-19 07:58

Subject: Get a copy of an old version of a file, using git gui/gitk
Message-ID: <Pine.LNX.4.64.0809190855060.17960@ds9.cixit.se>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0809190855060.17960%40ds9.cixit.se

```
Hi!

I am trying to introduce new people to Git, and am primarily showing
how to use the GUI tools (git gui/gitk), since the project is running
on Windows. A question that I couldn't answer arose:

How do I save a copy of an older version of a file (one that has either
been modified locally, or an earlier version in the project history),
from git gui or gitk?

>From the command line, I would try to find the SHA-1 and use git
cat-file, but I can't figure out how to do it from the GUIs. Or, to
fall back to the command-line, how to get the SHA-1 for the object out
of git gui/gitk.

-- 
\\// Peter - http://www.softwolves.pp.se/

```

## Björn Steinbrink, 2008-09-19 08:20

Subject: Re: Get a copy of an old version of a file, using git gui/gitk
Message-ID: <20080919082047.GA10733@atjola.homenet>
URL: https://gitlist.dev/e/20080919082047.GA10733%40atjola.homenet
In-Reply-To: <Pine.LNX.4.64.0809190855060.17960@ds9.cixit.se>

```
On 2008.09.19 08:58:04 +0100, Peter Krefting wrote:
> From the command line, I would try to find the SHA-1 and use git
> cat-file, but I can't figure out how to do it from the GUIs. Or, to
> fall back to the command-line, how to get the SHA-1 for the object out
> of git gui/gitk.

You don't need the sha1 of the blob object, just the revision and the
filename, and then you can reference the blob using the
<tree-ish>:<path> syntax.

For example:
	git cat-file blob HEAD^^^:some/file.c
or less plumb-ish:
	git show HEAD^^^:some/file.c

I've been told that neither cares about the CRLF conversion, and I don't
know if there's anything except "git checkout" that actually does care
about it. With checkout, you would do:

git checkout HEAD^^^ -- some/file.c

But that replaces the current version of that file in your working tree
and index with the version from the HEAD^^^ revision, so that might not
be exactly what you were looking for.

Björn

```
