Re: Elegant subdirectory checkout of remote-tracking branch?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]