{"thread":{"id":"9040","subject":"Exporting a tree from a repository","startedAt":"2007-07-14T20:25:52Z","lastAt":"2007-07-15T09:15:10Z","messageCount":6,"participants":["Ciprian Dorin Craciun","Julian Phillips","Junio C Hamano","martin f krafft","Alex Riesen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"47376","messageId":"8e04b5820707141325o400e170bu9eb80b304cae506b@mail.gmail.com","threadId":"9040","inReplyTo":null,"subject":"Exporting a tree from a repository","fromName":"Ciprian Dorin Craciun","fromEmail":"ciprian.craciun@gmail.com","sentAt":"2007-07-14T20:25:52Z","receivedAt":"2007-07-14T20:25:52Z","isPatch":false,"sender":{"key":"ciprian.craciun@gmail.com","avatar":"https://gravatar.com/avatar/9685eb13288a2c28bdde10acdcda9f15d495efad7b12bf49e3525eb7b8acf944?d=mp&s=160"},"body":"    Hello all!\n\n    I am a new GIT user, I like it, so I started playing with it for\ndifferent projects I work on.\n\n    Currently I am playing with \"Linux from Scratch\", and I have\nwritten some scripts to automatize the build process -- kind of\ninstall scripts...\n\n    For this I use GIT to store all the source packages -- each inside\nit's own branch :).\n\n    My question is the following: How can I export an entire tree\nwithout using a working directory, or cloning the repository. (Because\nfrom what I have seen so far there is no way to use the same\nrepository with many working directories...)\n\n    Now I know that I can use \"git archive | tar -x\"... I am looking\nfor the same functionality but without the intermediary file... Maybe\nsomething like \"git archive --format=tree <branch>\"...\n\n    Also there is also a possible drawback by using git archive with\ntar format, that is if I decide to make the repository available to\nthe public then it would be nice to have this export functionality...\nI think this could be also used for kernel sources as an alternative\nto downloading the tar.bz2 file or copying the entire tree...\n\n    Thank you all for your feedback!\n    Ciprian Craciun.\n"},{"id":"47382","messageId":"Pine.LNX.4.64.0707142237190.13310@beast.quantumfyre.co.uk","threadId":"9040","inReplyTo":"8e04b5820707141325o400e170bu9eb80b304cae506b@mail.gmail.com","subject":"Re: Exporting a tree from a repository","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2007-07-14T21:46:11Z","receivedAt":"2007-07-14T21:46:11Z","isPatch":false,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"On Sat, 14 Jul 2007, Ciprian Dorin Craciun wrote:\n\n>   Hello all!\n>\n>   I am a new GIT user, I like it, so I started playing with it for\n> different projects I work on.\n>\n>   Currently I am playing with \"Linux from Scratch\", and I have\n> written some scripts to automatize the build process -- kind of\n> install scripts...\n>\n>   For this I use GIT to store all the source packages -- each inside\n> it's own branch :).\n>\n>   My question is the following: How can I export an entire tree\n> without using a working directory, or cloning the repository. (Because\n> from what I have seen so far there is no way to use the same\n> repository with many working directories...)\n\nYou can have as many working directories as you want from one repository \nusing the git-new-workdir script from contrib/workdir.  You do need to be \ncareful when updating references though (you basically want to avoid \nupdating a reference that you are using in another working directory).\n\nYou should also be able to use this to get an \"export\" - simply create the \nnew workdir and then remove the .git (being careful not to accidentally do \nthis in your actual repository).  However I expect there is a better way \nto do this ...\n\n-- \nJulian\n\n  ---\nQuark!  Quark!  Beware the quantum duck!\n"},{"id":"47400","messageId":"7vy7hidwlf.fsf@assigned-by-dhcp.cox.net","threadId":"9040","inReplyTo":"Pine.LNX.4.64.0707142237190.13310@beast.quantumfyre.co.uk","subject":"Re: Exporting a tree from a repository","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-15T06:12:12Z","receivedAt":"2007-07-15T06:12:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Julian Phillips <julian@quantumfyre.co.uk> writes:\n\n> You should also be able to use this to get an \"export\" - simply create\n> the new workdir and then remove the .git (being careful not to\n> accidentally do this in your actual repository).  However I expect\n> there is a better way to do this ...\n\nYou meant \"git-archive\" perhaps.\n"},{"id":"47402","messageId":"8e04b5820707150012r13c5db69g96b97d910dc1b137@mail.gmail.com","threadId":"9040","inReplyTo":"Pine.LNX.4.64.0707142237190.13310@beast.quantumfyre.co.uk","subject":"Re: Exporting a tree from a repository","fromName":"Ciprian Dorin Craciun","fromEmail":"ciprian.craciun@gmail.com","sentAt":"2007-07-15T07:12:08Z","receivedAt":"2007-07-15T07:12:08Z","isPatch":false,"sender":{"key":"ciprian.craciun@gmail.com","avatar":"https://gravatar.com/avatar/9685eb13288a2c28bdde10acdcda9f15d495efad7b12bf49e3525eb7b8acf944?d=mp&s=160"},"body":"On 7/15/07, Julian Phillips <julian@quantumfyre.co.uk> wrote:\n> On Sat, 14 Jul 2007, Ciprian Dorin Craciun wrote:\n>\n> >   Hello all!\n> >\n> >   I am a new GIT user, I like it, so I started playing with it for\n> > different projects I work on.\n> >\n> >   Currently I am playing with \"Linux from Scratch\", and I have\n> > written some scripts to automatize the build process -- kind of\n> > install scripts...\n> >\n> >   For this I use GIT to store all the source packages -- each inside\n> > it's own branch :).\n> >\n> >   My question is the following: How can I export an entire tree\n> > without using a working directory, or cloning the repository. (Because\n> > from what I have seen so far there is no way to use the same\n> > repository with many working directories...)\n>\n> You can have as many working directories as you want from one repository\n> using the git-new-workdir script from contrib/workdir.  You do need to be\n> careful when updating references though (you basically want to avoid\n> updating a reference that you are using in another working directory).\n>\n> You should also be able to use this to get an \"export\" - simply create the\n> new workdir and then remove the .git (being careful not to accidentally do\n> this in your actual repository).  However I expect there is a better way\n> to do this ...\n>\n> --\n> Julian\n>\n>   ---\n> Quark!  Quark!  Beware the quantum duck!\n\n\n    Thank you for the hint about git-new-workdir! I will try it.\n\n    Now for the export thing... I know that I can just clone the\nremote repository and then remove the .git folder, but for my purpose\nI just want to have the HEAD tree downloaded, without any history...\nAnd by using git clone I end up downloading much more than I actually\nneed.\n\n    I am looking for a feature like 'svn export <repo+tree_path>\n<destination_path>'...\n\n    Ciprian.\n"},{"id":"47403","messageId":"20070715071716.GA22798@piper.oerlikon.madduck.net","threadId":"9040","inReplyTo":"8e04b5820707141325o400e170bu9eb80b304cae506b@mail.gmail.com","subject":"Re: Exporting a tree from a repository","fromName":"martin f krafft","fromEmail":"madduck@madduck.net","sentAt":"2007-07-15T07:17:16Z","receivedAt":"2007-07-15T07:17:16Z","isPatch":false,"sender":{"key":"madduck@madduck.net","avatar":null},"body":"also sprach Ciprian Dorin Craciun <ciprian.craciun@gmail.com> [2007.07.14.2225 +0200]:\n>    Now I know that I can use \"git archive | tar -x\"... I am looking\n> for the same functionality but without the intermediary file... Maybe\n> something like \"git archive --format=tree <branch>\"...\n\nThere is no intermediary file.\n\n-- \nmartin;              (greetings from the heart of the sun.)\n  \\____ echo mailto: !#^.\"<*>\"|tr \"<*> mailto:\" net@madduck\n \nspamtraps: madduck.bogus@madduck.net\n \n\"when I was a boy I was told\n that anybody could become president.\n now i'm beginning to believe it.\"\n                                                    -- clarence darrow\n"},{"id":"47408","messageId":"20070715091510.GC2568@steel.home","threadId":"9040","inReplyTo":"8e04b5820707150012r13c5db69g96b97d910dc1b137@mail.gmail.com","subject":"Re: Exporting a tree from a repository","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-07-15T09:15:10Z","receivedAt":"2007-07-15T09:15:10Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Ciprian Dorin Craciun, Sun, Jul 15, 2007 09:12:08 +0200:\n>    Now for the export thing... I know that I can just clone the\n> remote repository and then remove the .git folder, but for my purpose\n> I just want to have the HEAD tree downloaded, without any history...\n> And by using git clone I end up downloading much more than I actually\n> need.\n\nWell, if you have a ssh access to remote repository, you can run\ngit-archive there:\n\n    $ ssh -n 'cd /dir/repo/.git && git --bare archive --prefix=<local-path> <tree>' |tar xf -\n\nor even simplier:\n\n    $ git archive --remote=<remote-host:remote-path> --prefix=<local-path>/ <tree> |tar xf -\n\n(for whatever reason it does not work with just git-daemon).\n"}]}