{"thread":{"id":"3745","subject":"Cherry-pick particular object","startedAt":"2006-03-28T16:31:07Z","lastAt":"2006-03-28T23:28:51Z","messageCount":9,"participants":["Sébastien Pierre","sean","Shawn Pearce","Tony Luck","Linus Torvalds","Petr Baudis"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"18079","messageId":"20060328113107.20ab4c21.sebastien@xprima.com","threadId":"3745","inReplyTo":null,"subject":"Cherry-pick particular object","fromName":"Sébastien Pierre","fromEmail":"sebastien@xprima.com","sentAt":"2006-03-28T16:31:07Z","receivedAt":"2006-03-28T16:31:07Z","isPatch":false,"sender":{"key":"sebastien@xprima.com","avatar":null},"body":"Hi all,\n\nThis is a newbie question.\n\nI recently wanted to \"cherry\" pick a particular file from my git-managed project history. Using gitk, I identified which was the revision I wanted (95ba0c74e03874e8c1721b91f92f161e9061621f), and then using git ls-tree, I managed to get the id of the file I wanted (78132af26431e649a0f85f22dc27e5787d80700f).\n\nNow, what I simply wanted was to do something like:\n\n\"get the file corresponding to 78132af26431e649a0f85f22dc27e5787d80700f and save it as myfile.txt\"\n\nHow would one properly do that with core git ?\n\n -- Sébastien\n"},{"id":"18083","messageId":"20060328122301.f74ee9c4.sebastien@xprima.com","threadId":"3745","inReplyTo":"BAYC1-PASMTP02B05019F52DE48793CB39AED30@CEZ.ICE","subject":"Re: Cherry-pick particular object","fromName":"Sébastien Pierre","fromEmail":"sebastien@xprima.com","sentAt":"2006-03-28T17:23:01Z","receivedAt":"2006-03-28T17:23:01Z","isPatch":false,"sender":{"key":"sebastien@xprima.com","avatar":null},"body":"On Tue, 28 Mar 2006 16:34:22 -0500\nsean <seanlkml@sympatico.ca> wrote:\n\n> If you used:\n> \n> $ git cat-file -t 78132af2643\n> \n> It would tell you that this object is of type \"blob\".\n> To see the contents of blobs you can do something like:\n> \n> $ git cat-file blob 78132af2643\n\nThanks. That was exactly what I was looking for :)\n\n -- Sébastien\n"},{"id":"18080","messageId":"BAYC1-PASMTP02B05019F52DE48793CB39AED30@CEZ.ICE","threadId":"3745","inReplyTo":"20060328113107.20ab4c21.sebastien@xprima.com","subject":"Re: Cherry-pick particular object","fromName":"sean","fromEmail":"seanlkml@sympatico.ca","sentAt":"2006-03-28T21:34:22Z","receivedAt":"2006-03-28T21:34:22Z","isPatch":false,"sender":{"key":"seanlkml@sympatico.ca","avatar":"https://gravatar.com/avatar/f92923f54fc08c401fc59b71829d4b89e9b8087fbba45ff87c82e6a83aee02ae?d=mp&s=160"},"body":"On Tue, 28 Mar 2006 11:31:07 -0500\nSébastien Pierre <sebastien@xprima.com> wrote:\n\n> Hi all,\n> \n> This is a newbie question.\n> \n> I recently wanted to \"cherry\" pick a particular file from my \n> git-managed project history. Using gitk, I identified which was \n> the revision I wanted (95ba0c74e03874e8c1721b91f92f161e9061621f), \n> and then using git ls-tree, I managed to get the id of the file I \n> wanted (78132af26431e649a0f85f22dc27e5787d80700f).\n> \n> Now, what I simply wanted was to do something like:\n> \n> \"get the file corresponding to 78132af26431e649a0f85f22dc27e5787d80700f \n>  and save it as myfile.txt\"\n> \n> How would one properly do that with core git ?\n\nIf you used:\n\n$ git cat-file -t 78132af2643\n\nIt would tell you that this object is of type \"blob\".\nTo see the contents of blobs you can do something like:\n\n$ git cat-file blob 78132af2643\n\nSean\n"},{"id":"18081","messageId":"20060328213744.GD14457@spearce.org","threadId":"3745","inReplyTo":"20060328113107.20ab4c21.sebastien@xprima.com","subject":"Re: Cherry-pick particular object","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-03-28T21:37:44Z","receivedAt":"2006-03-28T21:37:44Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"S?bastien Pierre <sebastien@xprima.com> wrote:\n> Hi all,\n> \n> This is a newbie question.\n> \n> I recently wanted to \"cherry\" pick a particular file from my\n> git-managed project history. Using gitk, I identified which was\n> the revision I wanted (95ba0c74e03874e8c1721b91f92f161e9061621f),\n> and then using git ls-tree, I managed to get the id of the file I\n> wanted (78132af26431e649a0f85f22dc27e5787d80700f).\n> \n> Now, what I simply wanted was to do something like:\n> \n> \"get the file corresponding to\n> 78132af26431e649a0f85f22dc27e5787d80700f and save it as myfile.txt\"\n> \n> How would one properly do that with core git ?\n\ngit cat-file blob 78132af26431e649a0f85f22dc27e5787d80700f >myfile.txt\n\n-- \nShawn.\n"},{"id":"18082","messageId":"12c511ca0603281338q503638bfo66fa0a5da19942e2@mail.gmail.com","threadId":"3745","inReplyTo":"20060328113107.20ab4c21.sebastien@xprima.com","subject":"Re: Cherry-pick particular object","fromName":"Tony Luck","fromEmail":"tony.luck@intel.com","sentAt":"2006-03-28T21:38:13Z","receivedAt":"2006-03-28T21:38:13Z","isPatch":false,"sender":{"key":"tony.luck@intel.com","avatar":"https://avatars.githubusercontent.com/u/5446021?v=4"},"body":"> \"get the file corresponding to 78132af26431e649a0f85f22dc27e5787d80700f and save it as myfile.txt\"\n>\n> How would one properly do that with core git ?\n\n$ git cat-file blob 78132af2643 > myfile.txt\n\n-Tony\n"},{"id":"18084","messageId":"Pine.LNX.4.64.0603281435410.15714@g5.osdl.org","threadId":"3745","inReplyTo":"BAYC1-PASMTP02B05019F52DE48793CB39AED30@CEZ.ICE","subject":"Re: Cherry-pick particular object","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-03-28T22:44:02Z","receivedAt":"2006-03-28T22:44:02Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 28 Mar 2006, sean wrote:\n> \n> $ git cat-file -t 78132af2643\n\nSide note: when using git-ls-tree, the \"blob\"ness information is already \nin the tree output itself and you shouldn't even need to check the type \nwith \"-t\". So what is perhaps somewhat more interesting is actually the \nmode of the file, since that determines whether the blob should be \ninterpreted as regular file content or as a symlink.\n\nIe you can have a tree like this:\n\n\t100644 blob f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f    abc\n\t120000 blob f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f    file\n\nwhere the first one is a regular file called \"abc\" (which contains the \nstring \"abc\"), and the second is the _symlink_ that points to \"abc\".\n\nThey share the exact same blob, and what distinguishes them is the \nfilemode info from git-read-tree.\n\nOf course, the symlink case isn't very common and likely not very \ninteresting in this case, but the fact that \"git ls-files\" is set up so \nthat you can just cut-and-paste the \"blob <sha1-of-blob\" part and feed it \nto git-cat-file was definitely not just coincidence.\n\n(A number of the early stuff was set up so that I could do things by hand \nby just doing cut-and-paste of the output of the previous command. Git has \ncome a long way in the last 12 months ;)\n\n\t\tLinus\n"},{"id":"18088","messageId":"20060328225429.GD27689@pasky.or.cz","threadId":"3745","inReplyTo":"Pine.LNX.4.64.0603281435410.15714@g5.osdl.org","subject":"Re: Cherry-pick particular object","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-03-28T22:54:29Z","receivedAt":"2006-03-28T22:54:29Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Wed, Mar 29, 2006 at 12:44:02AM CEST, I got a letter\nwhere Linus Torvalds <torvalds@osdl.org> said that...\n> Ie you can have a tree like this:\n> \n> \t100644 blob f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f    abc\n> \t120000 blob f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f    file\n> \n> where the first one is a regular file called \"abc\" (which contains the \n> string \"abc\"), and the second is the _symlink_ that points to \"abc\".\n> \n> They share the exact same blob, and what distinguishes them is the \n> filemode info from git-read-tree.\n\nHuh? Didn't you rather want to say that \"file\" will point to a blob\ncontaining just the \"abc\" string (the symlink target)? ;-)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nRight now I am having amnesia and deja-vu at the same time.  I think\nI have forgotten this before.\n"},{"id":"18092","messageId":"Pine.LNX.4.64.0603281512260.15714@g5.osdl.org","threadId":"3745","inReplyTo":"20060328225429.GD27689@pasky.or.cz","subject":"Re: Cherry-pick particular object","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-03-28T23:24:13Z","receivedAt":"2006-03-28T23:24:13Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 29 Mar 2006, Petr Baudis wrote:\n\n> Dear diary, on Wed, Mar 29, 2006 at 12:44:02AM CEST, I got a letter\n> where Linus Torvalds <torvalds@osdl.org> said that...\n> > Ie you can have a tree like this:\n> > \n> > \t100644 blob f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f    abc\n> > \t120000 blob f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f    file\n> > \n> > where the first one is a regular file called \"abc\" (which contains the \n> > string \"abc\"), and the second is the _symlink_ that points to \"abc\".\n> > \n> > They share the exact same blob, and what distinguishes them is the \n> > filemode info from git-read-tree.\n> \n> Huh? Didn't you rather want to say that \"file\" will point to a blob\n> containing just the \"abc\" string (the symlink target)? ;-)\n\nWell no, maybe I should have called the first file something else.\n\nBoth \"abc\" and \"file\" from a git perspective have the same _contents_ (the \nblob containing the data 'abc'). \n\nBut the filemode means that those contents have totally different meaning. \nFor the pth \"file\", it means that it's a _symlink_ to \"abc\", while for the \npath \"abc\" it's a regular file that just has the _contents_ \"abc\".\n\nSo the end _result_ of this is that \"file\" points to a file called \"abc\" \nthat also has the contents \"abc\", and \"cat file abc\" will result in \n\"abcabc\".\n\nIOW, this is the result of doing\n\n\techo -n abc > abc\n\tln -s abc file\n\nand importing the mess into git.\n\n\t\tLinus\n"},{"id":"18093","messageId":"20060328232851.GE27689@pasky.or.cz","threadId":"3745","inReplyTo":"Pine.LNX.4.64.0603281512260.15714@g5.osdl.org","subject":"Re: Cherry-pick particular object","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-03-28T23:28:51Z","receivedAt":"2006-03-28T23:28:51Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Wed, Mar 29, 2006 at 01:24:13AM CEST, I got a letter\nwhere Linus Torvalds <torvalds@osdl.org> said that...\n> On Wed, 29 Mar 2006, Petr Baudis wrote:\n> \n> > Dear diary, on Wed, Mar 29, 2006 at 12:44:02AM CEST, I got a letter\n> > where Linus Torvalds <torvalds@osdl.org> said that...\n> > > Ie you can have a tree like this:\n> > > \n> > > \t100644 blob f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f    abc\n> > > \t120000 blob f2ba8f84ab5c1bce84a7b441cb1959cfc7093b7f    file\n> > > \n> > > where the first one is a regular file called \"abc\" (which contains the \n> > > string \"abc\"), and the second is the _symlink_ that points to \"abc\".\n> > > \n> > > They share the exact same blob, and what distinguishes them is the \n> > > filemode info from git-read-tree.\n> > \n> > Huh? Didn't you rather want to say that \"file\" will point to a blob\n> > containing just the \"abc\" string (the symlink target)? ;-)\n> \n> Well no, maybe I should have called the first file something else.\n> \n> Both \"abc\" and \"file\" from a git perspective have the same _contents_ (the \n> blob containing the data 'abc'). \n\nOh, I've totally missed the '(which contains the string \"abc\")' part,\nsorry. Apparently it's time to sleep for me. :/\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nRight now I am having amnesia and deja-vu at the same time.  I think\nI have forgotten this before.\n"}]}