* Re: Get a copy of an old version of a file, using git gui/gitk
@ 2008-09-19 8:32 dhruva
2008-09-19 9:12 ` Björn Steinbrink
0 siblings, 1 reply; 4+ messages in thread
From: dhruva @ 2008-09-19 8:32 UTC (permalink / raw)
To: Björn Steinbrink, Peter Krefting; +Cc: Git Mailing List
Using gitk, you can branch at the change that has the file (and content, I am not using version as git does not version files) you want. Check out that branch and you will have that file (and all other files at that changeset). When you are done, you can just delete that branch... branching is _cheap_
-dhruva
----- Original Message ----
> From: Björn Steinbrink <B.Steinbrink@gmx.de>
> To: Peter Krefting <peter@softwolves.pp.se>
> Cc: Git Mailing List <git@vger.kernel.org>
> Sent: Friday, 19 September, 2008 1:50:47 PM
> Subject: Re: Get a copy of an old version of a file, using git gui/gitk
>
> 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
> :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
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Did you know? You can CHAT without downloading messenger. Go to http://in.webmessenger.yahoo.com/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: Get a copy of an old version of a file, using git gui/gitk
2008-09-19 8:32 Get a copy of an old version of a file, using git gui/gitk dhruva
@ 2008-09-19 9:12 ` Björn Steinbrink
0 siblings, 0 replies; 4+ messages in thread
From: Björn Steinbrink @ 2008-09-19 9:12 UTC (permalink / raw)
To: dhruva; +Cc: Peter Krefting, Git Mailing List
[Fixed that top-posting for you...]
On 2008.09.19 14:02:30 +0530, dhruva wrote:
> From: Björn Steinbrink <B.Steinbrink@gmx.de>
> > 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
> > :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.
>
> Using gitk, you can branch at the change that has the file (and
> content, I am not using version as git does not version files) you
> want. Check out that branch and you will have that file (and all other
> files at that changeset). When you are done, you can just delete that
> branch... branching is _cheap_
Yeah, that works, but only if you have no uncommitted changes (which
git would try to apply to the version you check out). And that obviously
replaces _all_ files in your working tree and index, so that doesn't
have any advantages compared to the "git checkout $commit -- file"
approach. The disadvantage is just shifted from "uncommitted changes to
that file are lost" to "uncommitted changes to that file are kept", so
you don't even get the actual version of that file that you wanted to
have in the first place.
Besides that, why even bother with branch creation at all? Just checkout
that revision (puts you on a detached HEAD), do whatever you want, and
checkout the branch you were working on again. No need to create a
branch if you don't intend to create commits you want to keep...
Björn
^ permalink raw reply [flat|nested] 4+ messages in thread
* Get a copy of an old version of a file, using git gui/gitk
@ 2008-09-19 7:58 Peter Krefting
2008-09-19 8:20 ` Björn Steinbrink
0 siblings, 1 reply; 4+ messages in thread
From: Peter Krefting @ 2008-09-19 7:58 UTC (permalink / raw)
To: Git Mailing List
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/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Get a copy of an old version of a file, using git gui/gitk
2008-09-19 7:58 Peter Krefting
@ 2008-09-19 8:20 ` Björn Steinbrink
0 siblings, 0 replies; 4+ messages in thread
From: Björn Steinbrink @ 2008-09-19 8:20 UTC (permalink / raw)
To: Peter Krefting; +Cc: Git Mailing List
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-09-19 9:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-19 8:32 Get a copy of an old version of a file, using git gui/gitk dhruva
2008-09-19 9:12 ` Björn Steinbrink
-- strict thread matches above, loose matches on Subject: below --
2008-09-19 7:58 Peter Krefting
2008-09-19 8:20 ` Björn Steinbrink
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox