git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "W. Trevor King" <wking@tremily.us>
Cc: Git <git@vger.kernel.org>
Subject: Re: Elegant subdirectory checkout of remote-tracking branch?
Date: Sat, 2 Mar 2013 03:04:25 -0500	[thread overview]
Message-ID: <20130302080425.GA22861@sigill.intra.peff.net> (raw)
In-Reply-To: <20130301152253.GA9312@odin.tremily.us>

On Fri, Mar 01, 2013 at 10:22:53AM -0500, W. Trevor King wrote:

> These fail because I can't use a remote tracking branch as a
> source for the clone.  It should be possible to do:
> 
>   $ git clone --reference . --single-branch --branch todo git://git.kernel.org/pub/scm/git/git.git Meta
> 
> but that will require (I think) network access during a fetch.

Yes, it will. Junio mentioned already that for him, "Meta" is really a
separate repository, and I think the simplest thing is to just treat it
that way (that's how I handle my personal "meta" branch).

But if you really want to save the extra network round trip during a
fetch, you can either:

  1. Just fetch from the surrounding repository using a custom refspec,
     like:

       git init Meta
       cd Meta
       git config add remote.origin.url ..
       git config add remote.origin.fetch \
         refs/remotes/origin/todo:refs/remotes/origin/todo
       git fetch
       git checkout todo

or

  2. Look into the git-new-workdir script in contrib/workdir, which lets
     you check out an alternate branch in a separate directory.

The latter would probably be the most seamless, but it's also the most
likely to have bugs. :)

-Peff

      parent reply	other threads:[~2013-03-02  8:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-01 15:22 Elegant subdirectory checkout of remote-tracking branch? W. Trevor King
2013-03-01 18:05 ` Junio C Hamano
2013-03-02  8:04 ` Jeff King [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=20130302080425.GA22861@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=wking@tremily.us \
    /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).