From: Jeff King <peff@peff.net>
To: "Дилян Палаузов" <dilyan.palauzov@aegee.org>
Cc: git@vger.kernel.org
Subject: Re: git clone -b
Date: Mon, 8 May 2017 03:42:44 -0400 [thread overview]
Message-ID: <20170508074244.tcu2ywil2m47375k@sigill.intra.peff.net> (raw)
In-Reply-To: <219f3882-ec66-5c36-a157-5b920a2e4d04@aegee.org>
On Mon, May 08, 2017 at 08:30:49AM +0200, Дилян Палаузов wrote:
> why do these work:
>
> git clone --bare -b 3.5 https://github.com/python/cpython A
> git clone -b 3.6 A B
From the description of --bare in "git help clone":
[...]the branch heads at the remote are copied directly to
corresponding local branch heads, without mapping them to
refs/remotes/origin/. When this option is used, neither
remote-tracking branches nor the related configuration variables are
created.
So because the upstream has a refs/heads/3.6 branch, so too does the
bare clone "A". And thus when you clone it asking for that branch, Git
can find it.
But in your non-bare example:
> git clone -b 3.5 https://github.com/python/cpython C
>
> but these not:
>
> git clone -b 3.6 C D
> git clone --no-local -b 3.6 C D
In the non-bare clone C, there is no local 3.6 branch. You only have the
remote-tracking branch refs/remotes/origin/3.6. So when you try to clone
from it, Git can't find the branch:
$ git clone -b 3.6 C D
Cloning into 'D'...
fatal: Remote branch 3.6 not found in upstream origin
fatal: The remote end hung up unexpectedly
It works if you create a local branch based on upstream's branch:
$ git -C C checkout 3.6
Branch 3.6 set up to track remote branch 3.6 from origin.
Switched to a new branch '3.6'
$ git clone -b 3.6 C D
Cloning into 'D'...
done.
-Peff
next prev parent reply other threads:[~2017-05-08 7:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-08 6:30 git clone -b Дилян Палаузов
2017-05-08 7:42 ` Jeff King [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-06-28 11:59 Stefan Näwe
2013-06-28 12:15 ` Stefan Näwe
2013-06-28 12:18 ` Fredrik Gustafsson
2013-06-28 12:27 ` Stefan Näwe
2013-07-01 7:04 ` Stefan Näwe
2013-07-01 16:46 ` Junio C Hamano
2013-07-02 6:35 ` Stefan Näwe
2013-07-02 18:21 ` Junio C Hamano
2013-07-01 17:49 ` Phil Hord
2013-07-03 10:01 ` Jeff King
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170508074244.tcu2ywil2m47375k@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=dilyan.palauzov@aegee.org \
--cc=git@vger.kernel.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).