{"thread":{"id":"15587","subject":"Re: Get a copy of an old version of a file, using git gui/gitk","startedAt":"2008-09-19T08:32:30Z","lastAt":"2008-09-19T09:12:23Z","messageCount":2,"participants":["dhruva","Björn Steinbrink"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"91097","messageId":"884843.41605.qm@web95002.mail.in2.yahoo.com","threadId":"15587","inReplyTo":null,"subject":"Re: Get a copy of an old version of a file, using git gui/gitk","fromName":"dhruva","fromEmail":"dhruva@ymail.com","sentAt":"2008-09-19T08:32:30Z","receivedAt":"2008-09-19T08:32:30Z","isPatch":false,"sender":{"key":"dhruva@ymail.com","avatar":null},"body":"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_\n\n-dhruva\n\n\n\n----- Original Message ----\n> From: Björn Steinbrink <B.Steinbrink@gmx.de>\n> To: Peter Krefting <peter@softwolves.pp.se>\n> Cc: Git Mailing List <git@vger.kernel.org>\n> Sent: Friday, 19 September, 2008 1:50:47 PM\n> Subject: Re: Get a copy of an old version of a file, using git gui/gitk\n> \n> On 2008.09.19 08:58:04 +0100, Peter Krefting wrote:\n> > From the command line, I would try to find the SHA-1 and use git\n> > cat-file, but I can't figure out how to do it from the GUIs. Or, to\n> > fall back to the command-line, how to get the SHA-1 for the object out\n> > of git gui/gitk.\n> \n> You don't need the sha1 of the blob object, just the revision and the\n> filename, and then you can reference the blob using the\n> :syntax.\n> \n> For example:\n>     git cat-file blob HEAD^^^:some/file.c\n> or less plumb-ish:\n>     git show HEAD^^^:some/file.c\n> \n> I've been told that neither cares about the CRLF conversion, and I don't\n> know if there's anything except \"git checkout\" that actually does care\n> about it. With checkout, you would do:\n> \n> git checkout HEAD^^^ -- some/file.c\n> \n> But that replaces the current version of that file in your working tree\n> and index with the version from the HEAD^^^ revision, so that might not\n> be exactly what you were looking for.\n> \n> Björn\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\n\n\n      Did you know? You can CHAT without downloading messenger. Go to http://in.webmessenger.yahoo.com/\n"},{"id":"91098","messageId":"20080919091223.GA13778@atjola.homenet","threadId":"15587","inReplyTo":"884843.41605.qm@web95002.mail.in2.yahoo.com","subject":"Re: Get a copy of an old version of a file, using git gui/gitk","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2008-09-19T09:12:23Z","receivedAt":"2008-09-19T09:12:23Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"[Fixed that top-posting for you...]\n\nOn 2008.09.19 14:02:30 +0530, dhruva wrote:\n> From: Björn Steinbrink <B.Steinbrink@gmx.de>\n> > On 2008.09.19 08:58:04 +0100, Peter Krefting wrote:\n> > > From the command line, I would try to find the SHA-1 and use git\n> > > cat-file, but I can't figure out how to do it from the GUIs. Or, to\n> > > fall back to the command-line, how to get the SHA-1 for the object out\n> > > of git gui/gitk.\n> > \n> > You don't need the sha1 of the blob object, just the revision and the\n> > filename, and then you can reference the blob using the\n> > :syntax.\n> > \n> > For example:\n> >     git cat-file blob HEAD^^^:some/file.c\n> > or less plumb-ish:\n> >     git show HEAD^^^:some/file.c\n> > \n> > I've been told that neither cares about the CRLF conversion, and I don't\n> > know if there's anything except \"git checkout\" that actually does care\n> > about it. With checkout, you would do:\n> > \n> > git checkout HEAD^^^ -- some/file.c\n> > \n> > But that replaces the current version of that file in your working tree\n> > and index with the version from the HEAD^^^ revision, so that might not\n> > be exactly what you were looking for.\n>\n> Using gitk, you can branch at the change that has the file (and\n> content, I am not using version as git does not version files) you\n> want. Check out that branch and you will have that file (and all other\n> files at that changeset). When you are done, you can just delete that\n> branch... branching is _cheap_\n\nYeah, that works, but only if you have no uncommitted changes (which\ngit would try to apply to the version you check out). And that obviously\nreplaces _all_ files in your working tree and index, so that doesn't\nhave any advantages compared to the \"git checkout $commit -- file\"\napproach. The disadvantage is just shifted from \"uncommitted changes to\nthat file are lost\" to \"uncommitted changes to that file are kept\", so\nyou don't even get the actual version of that file that you wanted to\nhave in the first place.\n\nBesides that, why even bother with branch creation at all? Just checkout\nthat revision (puts you on a detached HEAD), do whatever you want, and\ncheckout the branch you were working on again. No need to create a\nbranch if you don't intend to create commits you want to keep...\n\nBjörn\n"}]}