Re: [RFC PATCH] switch: provide configurable detach
- From
- Thibaud CANALE <thican@thican.net>
- Date
- Apr 4, 2026, 21:26 UTC
- Message-ID
- <ebp7ebhushwhai3fms7xaseqqdwui7x43i4knwv5tkfkqyksqv@xtzmqnfgjqxc>
- In-Reply-To
- <CALnO6CA2_MjKENu3CK-zCfoG=edEuMm6rohBtJ_8JC9WgMudEw@mail.gmail.com>
On Saturday 2026-04-04 12:58:48-0400, D. Ben Knoble <ben.knoble@gmail.com> wrote:
Hello,
Show 15 quoted lines
> On Sat, Apr 4, 2026 at 10:36 AM Thibaud CANALE <thican@thican.net> wrote:
> >
> > Its purpose is to provide for git-switch(1) same detach behavior on
> > commit it than git-checkout(1) through configuration option
> > `checkout.switchDetach`.
>
> I considered contributing something similar at one point, though I
> would call it "switch.detach" ("<command>.<option>").
>
> I think I eventually decided against sending a patch because I was
> concerned that such an option might make using git-switch in scripts
> more of a headache. If I'm using it intentionally because it will fail
> in some circumstances without --detach, now I've got to also do "-c
> switch.detach=false" or something to control for the new
> configuration.I see what you mean, I could argue it’s a very niche option, only concerning git-switch(1), and in case we rely on git to block further actions if the provided reference is not a branch or simply working on detached states, it should not have any impact. This is what the newly implemented test cases are designed to ensure.
As mentioned it only implements the same behavior than git-checkout(1)’s concerning non-branch references.
Full disclosure, I am not even concerned about this feature, as I use switch/restore daily since 2017, but not everyone I know does; so here I try to ease transition for them.
Show 7 quoted lines
> On the one hand, I think that argument applies mostly to plumbing > rather than porcelain commands. On the other, a command for switching > branches whose behavior is reliable enough for scripts seems > worthwhile. So, idk :) > > -- > D. Ben Knoble
Also the purpose of this request is to provide this feature for Windows environment, which is out of my abilities concerning compilation, cannot compile without such environment.
Best regards,
-- Thibaud CANALE thican [at] thican [dot] net https://thican.net/ GPG: rsa4096 2013-10-14 485EF628CB85CDD4CB7CFF0D52F5127650733A18