From: Jonathan Nieder <jrnieder@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Josh Triplett <josh@joshtriplett.org>,
git@vger.kernel.org, Jamey Sharp <jamey@minilop.net>
Subject: Re: Cloning a remote tag without using git-fetch-pack directly?
Date: Wed, 20 Apr 2011 02:40:17 -0500 [thread overview]
Message-ID: <20110420073955.GA809@elie> (raw)
In-Reply-To: <20110420062653.GE28597@sigill.intra.peff.net>
Hi,
Some quick additional thoughts.
Jeff King wrote:
> To clone a subset of a repository, you have to do the init+fetch trick,
> as you did above. If you want the configuration set up by clone, you
> can do that, too, with "git config". So the equivalent commands to the
> clone you want are:
>
> git init linux-2.6
> cd linux-2.6
> git config remote.origin.url /home/josh/src/linux-2.6
> git config remote.origin.fetch refs/tags/v2.6.12
> git fetch origin
Someone fetching v2.6.12 to build on it today is probably not planning
to run "git fetch origin" to fetch the same tag tomorrow. So
git init linux-2.6
cd linux-2.6
git remote add origin ~/src/linux-2.6
git fetch origin refs/tags/v2.6.12
or even "...; git fetch ~/src/linux-2.6 refs/tags/v2.6.12" could be
closer to what is needed.
If for some reason you do want to track how the remote v2.6.12 tag
evolves, "git remote" has a funny way to do that:
git remote add --mirror=fetch -ttags/v2.6.12 origin ~/src/linux.2.6
The documentation calls the argument to -t "<branch>", but in mirror
mode it is actually a refspec relative to refs/.
With luck (depending on what you are looking to do),
git-new-workdir[1] or "git archive --remote" could also be helpful.
Regards,
Jonathan
[1] with the usual avoidable caveats described at
https://git.wiki.kernel.org/index.php/SoC2011Ideas#Multiple_work_trees
prev parent reply other threads:[~2011-04-20 7:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-19 22:20 Cloning a remote tag without using git-fetch-pack directly? Josh Triplett
2011-04-20 6:26 ` Jeff King
2011-04-20 7:27 ` Josh Triplett
2011-04-20 7:38 ` Jeff King
2011-04-20 7:40 ` Jonathan Nieder [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=20110420073955.GA809@elie \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=jamey@minilop.net \
--cc=josh@joshtriplett.org \
--cc=peff@peff.net \
/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).