Re: [PATCH] checkout: add config variable checkout.autoDetach
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Nov 13, 2023, 15:07 UTC
- Message-ID
- <0e37ee23-922c-4bbf-82c3-8f44e9216ab0@gmail.com>
- In-Reply-To
- <xmqqbkbzo6ba.fsf@gitster.g>
On 12/11/2023 06:04, Junio C Hamano wrote:
Show 21 quoted lines
> 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 do not know how others react to > this kind of proliferation of configuration variables, but I do not > mind this particular variable existing.
I'm a bit wary of having a config variable that could break scripts relying on the current behavior of "git checkout". As far as "git switch" goes I don't particularly mind this config variable though I'm not sure it is that hard to type "--detach" (especially with tab completion) and I do worry that we're making the UI more complex each time we add something like this.
Best Wishes
Phillip