git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Joshua Shrader <jshrader83@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Decompressing a tree to a location other than the working directory
Date: Fri, 06 Aug 2010 12:58:47 -0700 (PDT)	[thread overview]
Message-ID: <m3mxszo6na.fsf@localhost.localdomain> (raw)
In-Reply-To: <AANLkTi=RjcQ_-PNUt781jhYEA-8krqXpdHRenVyR_Rc4@mail.gmail.com>

Joshua Shrader <jshrader83@gmail.com> writes:

> git checkout allows one to checkout a particular version of a certain
> path in the working directory.  Are there accessible plumbing commands
> that can be used to accomplish the same thing, but change the target
> directory.  For example, if I wanted to checkout a certain path, but
> wanted to check it out somewhere external to my working directory /
> repository?

Porcelain way: check out first example in git-archive(1) manpage

  EXAMPLES
  ========

  git archive --format=tar --prefix=junk/ HEAD | (cd /var/tmp/ && tar xf -)

       Create a tar archive that contains the contents of the latest commit
       on the current branch, and extract it in the /var/tmp/junk directory.

Plumbing way: after preparing index (it can be separate file than .git/index),
use "git checkout-index" as desceived in second example on manpage:

  EXAMPLES
  ========


  Using `git checkout-index` to "export an entire tree"

        The  prefix  ability  basically  makes  it trivial to use git check-
        out-index as an "export as tree" function.  Just  read  the  desired
        tree into the index, and do:

          $ git checkout-index --prefix=git-export-dir/ -a

        `git checkout-index` will "export" the index into the specified direc-
        tory.

        The final "/" is important. The exported name is literally just pre-
        fixed  with  the  specified string


-- 
Jakub Narebski
Poland
ShadeHawk on #git

      parent reply	other threads:[~2010-08-06 19:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-06 18:43 Decompressing a tree to a location other than the working directory Joshua Shrader
2010-08-06 18:43 ` Jonathan Nieder
2010-08-07  3:10   ` Michael Witten
2010-08-06 19:58 ` Jakub Narebski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3mxszo6na.fsf@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jshrader83@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).