Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Thibaud CANALE <thican@thican.net>
Cc: git@vger.kernel.org
Subject: Re: [RFC PATCH] switch: provide configurable detach
Date: Mon, 06 Apr 2026 09:36:03 -0700	[thread overview]
Message-ID: <xmqq7bqkcah8.fsf@gitster.g> (raw)
In-Reply-To: <njuf62lav6akkmdyqutwk7pim5yutw5cuicjidwpe5eh6qnkqr@4ir6q4uhhvht> (Thibaud CANALE's message of "Sat, 4 Apr 2026 16:28:57 +0200")

Thibaud CANALE <thican@thican.net> writes:

> Its purpose is to provide for git-switch(1) same detach behavior on
> commit it than git-checkout(1) through configuration option
> `checkout.switchDetach`.
>
> Signed-off-by: Thibaud CANALE <thican@thican.net>
> ---
>  Documentation/config/checkout.adoc |  4 ++++
>  builtin/checkout.c                 | 18 +++++++++++++++---
>  t/t2060-switch.sh                  | 27 +++++++++++++++++++++++++++
>  3 files changed, 46 insertions(+), 3 deletions(-)

Sorry, but I am fairly negative on this change.

"switch" was an attempt to give folks an improved experience over
"checkout".  The implied "--detach" was deliberately removed from
the command and I do not think it was a bad move for our user base
who wanted to have "switch" that can only be used to switch branches
(as opposed to "checkout" that hecks out both files and branches).
With fewer choices in a single command that does only a single
thing, the hope was to make it simpler to teach.

And it is backwards to make "switch" configurable in that context.
It defeats a major point of "git switch".

FWIW, "git checkout" that knows what is and what is not a branch
name and does not require "--detach" when detaching to anything that
is not a branch name is always available and will not be going away.

  parent reply	other threads:[~2026-04-06 16:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-04 14:28 [RFC PATCH] switch: provide configurable detach Thibaud CANALE
2026-04-04 15:23 ` Pablo
2026-04-04 21:10   ` Thibaud CANALE
2026-04-04 16:58 ` D. Ben Knoble
2026-04-04 21:26   ` Thibaud CANALE
2026-04-04 21:14 ` [RFC PATCH v2] " Thibaud CANALE
2026-04-06 16:36 ` Junio C Hamano [this message]
2026-04-06 17:48   ` [RFC PATCH] " Kristoffer Haugsbakk
2026-04-07  0:50     ` 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=xmqq7bqkcah8.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=thican@thican.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