git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Michael J Gruber <git@drmicha.warpmail.net>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: RFC for 1.7: Do not checkout -b master origin/master on clone
Date: Tue, 11 Aug 2009 19:45:22 -0700	[thread overview]
Message-ID: <7v8whpda2l.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: 4A818B90.9050206@drmicha.warpmail.net

Michael J Gruber <git@drmicha.warpmail.net> writes:

> One common source of confusion for newcomers is the fact that master is
> given such a special treatment in git. While it is certainly okay and
> helpful to set up a default branch in a new repository (git init) it is
> not at all clear why it should be treated specially in any other
> situation, such as:
>
> - Why is master the only local branch which git clone sets up (git
> checkout -b master origin/master)?

As you know it is not strictly "master".  It is the primary branch at the
cloned repository, which by convention is master", but whatever remote end
points at with its HEAD.

We check out that primary branch to make it easy for people to work with
the simplest kind of CVS/SVN-like settings, which I suspect is 99% of
peoples' projects.  Single "trunk" that is checked out immediately after
cloning from a distribution point (read: a bare repository) ready to be
used.

> - Why does git svn set up a local branch with an svn upstream which is
> determined by latest svn commit at the time of the first git svn fetch?

I do not have comments on design decisions in git-svn, other than trusting
that Eric would exercise good design tastes to make things coherent with
the git native workflow when the consistency makes sense.

> ..., and git clone
> sets up a local branch according to HEAD (and does some other guess work
> when cloning bare repos), which means that git clone shows the same
> "random" behaviour...

It is because you are cloning from a repository that is used actively to
build new history, flipping the HEAD left and right.  That is where the
randomness comes from.  IOW, a repository with an active work tree.

If you are cloning because you have your own private working area and you
would want to get another private working area to work simultaneously, you
have "clone -n && checkout -t origin/whatever".  Also if you are doing
this on a local machine (which is somewhat common), there is new-workdir
script in contrib/.  But this is _not_ the most common case we should
optimize the usability of "clone" for.

  parent reply	other threads:[~2009-08-12  2:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-11 15:17 RFC for 1.7: Do not checkout -b master origin/master on clone Michael J Gruber
2009-08-11 21:06 ` Santi Béjar
2009-08-12  2:45 ` Junio C Hamano [this message]
2009-08-12  9:56   ` Eric Wong
2009-08-17 17:45 ` Matthieu Moy

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=7v8whpda2l.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@drmicha.warpmail.net \
    --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.
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).