git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Norbert Nemec <norbert.nemec@native-instruments.de>
Cc: git@vger.kernel.org
Subject: Re: shallow&single-branch clone?
Date: Thu, 20 Oct 2011 21:22:59 -0400	[thread overview]
Message-ID: <20111021012259.GA13421@sigill.intra.peff.net> (raw)
In-Reply-To: <4E9ED108.5020505@native-instruments.de>

On Wed, Oct 19, 2011 at 03:30:48PM +0200, Norbert Nemec wrote:

> Truncating history is done by 'git clone --depth 1', there is not way
> to restrict 'clone' to a single branch (the --branch option still
> downloads all branches and only then chooses something other than
> HEAD as active branch).
> 
> The manual sequence
> 	git init
> 	git remote add -t master -f origin URL
> 	git checkout
> allows a clone of a single branch but offers no means to truncate history.

You can do:

  git init
  git remote add -t master origin URL
  git fetch --depth=1
  git checkout

But obviously that's not as nice as an option to clone.

> The least intrusive solution would be an additional option to clone,
> perhaps '--branch-only'.

Agreed, that would be better. We might want to make it more flexible,
like:

  git clone --fetch=branch1 --fetch=branch2

and then by default choose "-b branch1" since it was mentioned first.

> More user friendly, this options should be on by default when --depth
> is set. After all: who would expect branches to be cloned when the
> history is explicitely truncated?

Yeah, that probably makes sense. If the branches are related, it's
probably not saving much, but if you have unrelated branches, it would
be a nice convenience. OTOH, how would you tell git "no, I really do
want the tip of every branch"?

-Peff

      reply	other threads:[~2011-10-21  1:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-19 13:30 shallow&single-branch clone? Norbert Nemec
2011-10-21  1:22 ` 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=20111021012259.GA13421@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=norbert.nemec@native-instruments.de \
    /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).