{"thread":{"id":"24649","subject":"Decompressing a tree to a location other than the working directory","startedAt":"2010-08-06T18:43:21Z","lastAt":"2010-08-07T03:10:28Z","messageCount":4,"participants":["Joshua Shrader","Jonathan Nieder","Jakub Narebski","Michael Witten"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"147333","messageId":"AANLkTi=RjcQ_-PNUt781jhYEA-8krqXpdHRenVyR_Rc4@mail.gmail.com","threadId":"24649","inReplyTo":null,"subject":"Decompressing a tree to a location other than the working directory","fromName":"Joshua Shrader","fromEmail":"jshrader83@gmail.com","sentAt":"2010-08-06T18:43:21Z","receivedAt":"2010-08-06T18:43:21Z","isPatch":false,"sender":{"key":"jshrader83@gmail.com","avatar":null},"body":"git checkout allows one to checkout a particular version of a certain\npath in the working directory.  Are there accessible plumbing commands\nthat can be used to accomplish the same thing, but change the target\ndirectory.  For example, if I wanted to checkout a certain path, but\nwanted to check it out somewhere external to my working directory /\nrepository?\n\nThanks,\n\nJosh\n"},{"id":"147334","messageId":"20100806184345.GB2985@burratino","threadId":"24649","inReplyTo":"AANLkTi=RjcQ_-PNUt781jhYEA-8krqXpdHRenVyR_Rc4@mail.gmail.com","subject":"Re: Decompressing a tree to a location other than the working directory","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-06T18:43:45Z","receivedAt":"2010-08-06T18:43:45Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Joshua Shrader wrote:\n\n> git checkout allows one to checkout a particular version of a certain\n> path in the working directory.  Are there accessible plumbing commands\n> that can be used to accomplish the same thing, but change the target\n> directory.\n\nI don’t know if it is plumbing, but \"git archive\" is very useful for\nthat.\n\n $ git archive HEAD^:Documentation | (cd elsewhere && tar xf -)\n\nHope that helps,\nJonathan\n"},{"id":"147340","messageId":"m3mxszo6na.fsf@localhost.localdomain","threadId":"24649","inReplyTo":"AANLkTi=RjcQ_-PNUt781jhYEA-8krqXpdHRenVyR_Rc4@mail.gmail.com","subject":"Re: Decompressing a tree to a location other than the working directory","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-08-06T19:58:47Z","receivedAt":"2010-08-06T19:58:47Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Joshua Shrader <jshrader83@gmail.com> writes:\n\n> git checkout allows one to checkout a particular version of a certain\n> path in the working directory.  Are there accessible plumbing commands\n> that can be used to accomplish the same thing, but change the target\n> directory.  For example, if I wanted to checkout a certain path, but\n> wanted to check it out somewhere external to my working directory /\n> repository?\n\nPorcelain way: check out first example in git-archive(1) manpage\n\n  EXAMPLES\n  ========\n\n  git archive --format=tar --prefix=junk/ HEAD | (cd /var/tmp/ && tar xf -)\n\n       Create a tar archive that contains the contents of the latest commit\n       on the current branch, and extract it in the /var/tmp/junk directory.\n\nPlumbing way: after preparing index (it can be separate file than .git/index),\nuse \"git checkout-index\" as desceived in second example on manpage:\n\n  EXAMPLES\n  ========\n\n\n  Using `git checkout-index` to \"export an entire tree\"\n\n        The  prefix  ability  basically  makes  it trivial to use git check-\n        out-index as an \"export as tree\" function.  Just  read  the  desired\n        tree into the index, and do:\n\n          $ git checkout-index --prefix=git-export-dir/ -a\n\n        `git checkout-index` will \"export\" the index into the specified direc-\n        tory.\n\n        The final \"/\" is important. The exported name is literally just pre-\n        fixed  with  the  specified string\n\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"147370","messageId":"AANLkTi=iApfmo3HhDU9BgxvJuHJwuDc=nHFpOib9TM8x@mail.gmail.com","threadId":"24649","inReplyTo":"20100806184345.GB2985@burratino","subject":"Re: Decompressing a tree to a location other than the working directory","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":"2010-08-07T03:10:28Z","receivedAt":"2010-08-07T03:10:28Z","isPatch":false,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"On Fri, Aug 6, 2010 at 13:43, Jonathan Nieder <jrnieder@gmail.com> wrote:\n>> git checkout allows one to checkout a particular version of a certain\n>> path in the working directory.  Are there accessible plumbing commands\n>> that can be used to accomplish the same thing, but change the target\n>> directory.\n>\n> I don’t know if it is plumbing, but \"git archive\" is very useful for\n> that.\n>\n>  $ git archive HEAD^:Documentation | (cd elsewhere && tar xf -)\n\nFor single files (rather than directories), you could do this:\n\n  git show HEAD^:path/to/file > /some/path/file\n"}]}