From: Andy Koppe <andy.koppe@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, pclouds@gmail.com
Subject: Re: [PATCH] checkout: add config variable checkout.autoDetach
Date: Sun, 12 Nov 2023 09:15:27 +0000 [thread overview]
Message-ID: <859a0c38-b7cd-4d6b-a4c8-c530fbe6e928@gmail.com> (raw)
In-Reply-To: <xmqqbkbzo6ba.fsf@gitster.g>
On 12/11/2023 06:04, Junio C Hamano wrote:
> Andy Koppe <andy.koppe@gmail.com> writes:
>
>> The git-checkout command without pathspecs automatically detaches HEAD
>> when switching to something other than a branch, whereas git-switch
>> requires the --detach option to do so.
>>
>> Add configuration variable checkout.autoDetach to choose the behavior
>> for both: true for automatic detaching, false for requiring --detach.
>>
>> Amend their documentation and tests accordingly.
>>
>> Signed-off-by: Andy Koppe <andy.koppe@gmail.com>
>> ---
>
> "switch" was meant to be an experimental command to sort out this
> kind of UI ideas, and I think the fact that it requires a more
> explicit "--detach", where experienced users might just say "git
> checkout that-branch^0", has established itself as a more friendly
> and good thing to help new users.
I agree, but as an experienced user, I nevertheless prefer switch and
restore over checkout, because those are rather different tasks, and
with checkout you're only ever a small thinko and errant dot away from
losing your local changes. If switch and restore had existed first, I
don't think anyone would be asking for mashing them together.
Incidentally, as reset is similarly overloaded, and restore can also
replace the forms of reset that take pathspec arguments, was there a
similar plan to factor the head-moving forms of reset out into a
separate command? (I realise there'd be little appetite for that after
the switch/restore experiment.)
> I do not know how others react to
> this kind of proliferation of configuration variables, but I do not
> mind this particular variable existing.
Thanks. There's also the checkout.guess variable as a closely related
precedent.
Regards,
Andy
next prev parent reply other threads:[~2023-11-12 9:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-11 22:42 [PATCH] checkout: add config variable checkout.autoDetach Andy Koppe
2023-11-12 6:04 ` Junio C Hamano
2023-11-12 9:15 ` Andy Koppe [this message]
2023-11-13 15:07 ` Phillip Wood
2023-11-14 0:48 ` 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=859a0c38-b7cd-4d6b-a4c8-c530fbe6e928@gmail.com \
--to=andy.koppe@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
/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).