switch requires --detach [[Re: What actually is a branch]]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 09/07/2021 17:08, Felipe Contreras wrote:
and the fact that
`git switch` expects branches is one of the things that bothers me about
it.

Ah, good point.

I would word it differently though.
"git switch forces the use of --detach if switching to a non branch"

Bit of a twist.
It's a nice safety for beginners. I remember when I started, I kept ending up detached. And I had no idea what to do next.


But once you are a bit more experienced the need to add that option can be bothersome.
It's not common in my workflow, but I can see that it can be an issue.

So how to remedy?

- Drop the option / Make it default?
- add --allow-detach  and git config switch.detach allow ?

I don't really have a preference.

I think its a nice protection, but even without it, the warning on entering detached HEAD state is pretty good.


There is also a curious side effect.

If you went into detached, you can go back to attached using
  git switch -

but not back to detached by again doing
  git switch -

Even though you had been there, and that means you had used --detached, and therefore known what you did.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux