{"thread":{"id":"20525","subject":"[Feature Request] git export","startedAt":"2009-08-10T16:22:59Z","lastAt":"2009-08-11T07:50:20Z","messageCount":7,"participants":["Thomas Koch","Tim Visher","Junio C Hamano","Johannes Schindelin","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"120188","messageId":"200908101822.59940.thomas@koch.ro","threadId":"20525","inReplyTo":null,"subject":"[Feature Request] git export","fromName":"Thomas Koch","fromEmail":"thomas@koch.ro","sentAt":"2009-08-10T16:22:59Z","receivedAt":"2009-08-10T16:22:59Z","isPatch":false,"sender":{"key":"thomas@koch.ro","avatar":null},"body":"could you please provide a simple solution to save a tree object into an \narbitrary location?\nI found some hints, that it would be possible by missusing either git \ncheckout-index or git-archive, but I think that it shouldn't require that much \nGIT FU to do such a simple thing.\n\nThanks,\n\nThomas Koch, http://www.koch.ro\n"},{"id":"120189","messageId":"c115fd3c0908100927v4d9e4a87we4502e91d3789138@mail.gmail.com","threadId":"20525","inReplyTo":"200908101822.59940.thomas@koch.ro","subject":"Re: [Feature Request] git export","fromName":"Tim Visher","fromEmail":"tim.visher@gmail.com","sentAt":"2009-08-10T16:27:43Z","receivedAt":"2009-08-10T16:27:43Z","isPatch":false,"sender":{"key":"tim.visher@gmail.com","avatar":"https://gravatar.com/avatar/98307ce54bcac1a46b5d845827d5386e2a27895ff08790cdd3877ad527760575?d=mp&s=160"},"body":"Hey Thomas,\n\nOn Mon, Aug 10, 2009 at 12:22 PM, Thomas Koch<thomas@koch.ro> wrote:\n> could you please provide a simple solution to save a tree object into an\n> arbitrary location?\n\nThis has been requested a few times and I have no idea what the\ndevelopment status of it is.  Most people seem to recommend just\nmaking an alias around git checkout-index.\n\n> I found some hints, that it would be possible by missusing either git\n> checkout-index or git-archive, but I think that it shouldn't require that much\n> GIT FU to do such a simple thing.\n\nIt's not really a misuse, as the [man page\nitself](http://www.kernel.org/pub/software/scm/git/docs/git-checkout-index.html)\nrecommends using checkout-index as a way to export an entire tree.\nUntil someone decides that it's worth making the porcelain command\n(like you perhaps) then I think you can just stick with checkout-index\nknowing you're not abusing anything.\n\n-- \n\nIn Christ,\n\nTimmy V.\n\nhttp://burningones.com/\nhttp://five.sentenc.es/ - Spend less time on e-mail\n"},{"id":"120191","messageId":"200908101841.00522.thomas@koch.ro","threadId":"20525","inReplyTo":"c115fd3c0908100927v4d9e4a87we4502e91d3789138@mail.gmail.com","subject":"Re: [Feature Request] git export","fromName":"Thomas Koch","fromEmail":"thomas@koch.ro","sentAt":"2009-08-10T16:41:00Z","receivedAt":"2009-08-10T16:41:00Z","isPatch":false,"sender":{"key":"thomas@koch.ro","avatar":null},"body":"Hi Tim,\n\nthanks for your explanation. Still I don't get how to do it with git checkout-\nindex. The man page says \"Just read the desired tree into the index\", but I \ndon't know what is meant by this.\n\n> Hey Thomas,\n>\n> On Mon, Aug 10, 2009 at 12:22 PM, Thomas Koch<thomas@koch.ro> wrote:\n> > could you please provide a simple solution to save a tree object into an\n> > arbitrary location?\n>\n> This has been requested a few times and I have no idea what the\n> development status of it is.  Most people seem to recommend just\n> making an alias around git checkout-index.\n>\n> > I found some hints, that it would be possible by missusing either git\n> > checkout-index or git-archive, but I think that it shouldn't require that\n> > much GIT FU to do such a simple thing.\n>\n> It's not really a misuse, as the [man page\n> itself](http://www.kernel.org/pub/software/scm/git/docs/git-checkout-index.\n>html) recommends using checkout-index as a way to export an entire tree.\n> Until someone decides that it's worth making the porcelain command (like\n> you perhaps) then I think you can just stick with checkout-index knowing\n> you're not abusing anything.\nThomas Koch, http://www.koch.ro\n"},{"id":"120195","messageId":"7vk51b38zj.fsf@alter.siamese.dyndns.org","threadId":"20525","inReplyTo":"200908101822.59940.thomas@koch.ro","subject":"Re: [Feature Request] git export","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-08-10T16:54:24Z","receivedAt":"2009-08-10T16:54:24Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thomas Koch <thomas@koch.ro> writes:\n\n> could you please provide a simple solution to save a tree object into an \n> arbitrary location?\n> I found some hints, that it would be possible by missusing either git \n> checkout-index or git-archive, but I think that it shouldn't require that much \n\nIf you are talking about a tree object, then git-archive is what you want.\nIt was invented almost for this exact purpose, but unlike \"export\" that\nwould only copy to a directory, you can get a tarball out of it when you\ndo not want to expand the result into a directory; it is more versatile\nform.  The manual page for the command has an example (look for\n\"/var/tmp\") so I won't repeat the cut-and-paste recipe here.\n\nIf you are not talking about a tree object but is talking about the\ncontents recorded in your index, checkout-index with the --prefix option\nmay be what you want.  The manual page for the command has an example\n(look for \"--prefix=git-export-dir/\") so I won't repeat it here.\n"},{"id":"120196","messageId":"alpine.DEB.1.00.0908101855260.8324@intel-tinevez-2-302","threadId":"20525","inReplyTo":"200908101822.59940.thomas@koch.ro","subject":"Re: [Feature Request] git export","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-08-10T16:56:39Z","receivedAt":"2009-08-10T16:56:39Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 10 Aug 2009, Thomas Koch wrote:\n\n> could you please provide a simple solution to save a tree object into an \n> arbitrary location?\n>\n> I found some hints, that it would be possible by missusing either git \n> checkout-index or git-archive, but I think that it shouldn't require \n> that much GIT FU to do such a simple thing.\n\nYou can check out Documentation/install-doc-quick.sh and find that \nsomething like\n\n\tGIT_INDEX_FILE=.git/tmp\n\texport GIT_INDEX_FILE\n\tgit read-tree $TREE\n\tgit checkout-index -a -f --prefix=/the/path\n\tunset GIT_INDEX_FILE\n\nshould work.\n\nHth,\nDscho\n"},{"id":"120203","messageId":"c115fd3c0908101131n20237b8bsb5f5a06ec4b2189c@mail.gmail.com","threadId":"20525","inReplyTo":"200908101841.00522.thomas@koch.ro","subject":"Re: [Feature Request] git export","fromName":"Tim Visher","fromEmail":"tim.visher@gmail.com","sentAt":"2009-08-10T18:31:22Z","receivedAt":"2009-08-10T18:31:22Z","isPatch":false,"sender":{"key":"tim.visher@gmail.com","avatar":"https://gravatar.com/avatar/98307ce54bcac1a46b5d845827d5386e2a27895ff08790cdd3877ad527760575?d=mp&s=160"},"body":"On Mon, Aug 10, 2009 at 12:41 PM, Thomas Koch<thomas@koch.ro> wrote:\n> thanks for your explanation. Still I don't get how to do it with git checkout-\n> index. The man page says \"Just read the desired tree into the index\", but I\n> don't know what is meant by this.\n\nNo problem.  That phrase gave me some trouble the first time I read it\ntoo.  All it means is 'do a `git checkout` of the branch that you want\nto export'.  `git checkout-index` will then do an export of the\ncontents the branch that you currently have checked out.\n\nJunio and Dscho's comments are possibly salient as well.\n\n-- \n\nIn Christ,\n\nTimmy V.\n\nhttp://burningones.com/\nhttp://five.sentenc.es/ - Spend less time on e-mail\n"},{"id":"120249","messageId":"4A8122BC.7030009@drmicha.warpmail.net","threadId":"20525","inReplyTo":"200908101822.59940.thomas@koch.ro","subject":"Re: [Feature Request] git export","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-08-11T07:50:20Z","receivedAt":"2009-08-11T07:50:20Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Thomas Koch venit, vidit, dixit 10.08.2009 18:22:\n> could you please provide a simple solution to save a tree object into an \n> arbitrary location?\n> I found some hints, that it would be possible by missusing either git \n> checkout-index or git-archive, but I think that it shouldn't require that much \n> GIT FU to do such a simple thing.\n> \n> Thanks,\n> \n> Thomas Koch, http://www.koch.ro\n\nTo serve you with an explicit command line, it's really only\n\ngit archive HEAD | tar -C wheretoexport/ -xf-\n\nwhich you need to issue from within your git repo. Instead of HEAD, you\ncan use any \"treeish\", for example the name of a branch, which need not\nbe checked out. You can add path arguments after the treeish if you want\nto export only parts of your repo.\n\nNote that in true unix philosophy, git archive does the (git specific)\nexporting only and leaves the importing into the file system (saving) to\nthe proper tool. I mean, would you rather use cp -r or pipes with tar\n-x/tar -c or cpio -i/-o in order to copy a tree? ;)\n\nCheers,\nMichael\n"}]}