git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH] switch: provide configurable detach

From
TCThibaud 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
Previous: D. Ben KnobleNext: Thibaud CANALE
Message 5 of 9 in “switch: provide configurable detach”
  1. switch: provide configurable detachThibaud CANALE, Apr 4, 2026
  2. PabloApr 4, 2026
  3. Thibaud CANALEApr 4, 2026
  4. D. Ben KnobleApr 4, 2026
  5. Thibaud CANALEApr 4, 2026
  6. switch: provide configurable detachThibaud CANALE, Apr 4, 2026
  7. Junio C HamanoApr 6, 2026
  8. Kristoffer HaugsbakkApr 6, 2026
  9. Junio C HamanoApr 7, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.