All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Craig H Maynard <chmaynard@me.com>
Cc: Git Community <git@vger.kernel.org>
Subject: Re: Orphan branch not well-defined?
Date: Wed, 22 Nov 2023 10:08:51 +0900	[thread overview]
Message-ID: <xmqqil5uegrg.fsf@gitster.g> (raw)
In-Reply-To: <FE2AD666-88DE-4F70-8D6D-3A426689EB41@me.com> (Craig H. Maynard's message of "Tue, 21 Nov 2023 19:28:36 -0500")

Craig H Maynard <chmaynard@me.com> writes:

> Recently I tried creating an orphan branch in an existing repo using git-checkout and git-switch. 
>
> Both commands have an --orphan option.
>
> The results were different:

This is one of the very much deliberate differences between "switch"
and "checkout" (there are others).

The "switch" command was introduced as an experiment to figure out a
better UI choices for one half of "checkout", which deals with
checking out a branch to a working tree (the other half being
"restore", which is about checking out files out of a tree-ish).
The initial round of "switch" proposed to go with the identical
semantics as "checkout" for the "--orphan" option [*1*], but during
review discussion, a concensus was reached that a better behaviour
for creating an entirely new history may be to start from void
[*2*], and that is what is in the experimental command you see.


[Reference]

*1* https://lore.kernel.org/git/20190130094831.10420-9-pclouds@gmail.com/

*2* https://lore.kernel.org/git/CABPp-BF3_p3+fmQcWYEu2z3J4FfPmDmiMyFiBRXyz8TxKLL7jA@mail.gmail.com/


  reply	other threads:[~2023-11-22  1:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22  0:28 Orphan branch not well-defined? Craig H Maynard
2023-11-22  1:08 ` Junio C Hamano [this message]
2023-11-22  1:42 ` Chris Torek
2023-11-24  2:03   ` Junio C Hamano
2023-11-24  2:12     ` Junio C Hamano
2023-11-24  2:27     ` Eric Sunshine
2023-11-24  2:31       ` Junio C Hamano

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=xmqqil5uegrg.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=chmaynard@me.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.