Re: switch requires --detach [[Re: What actually is a branch]]
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- Jul 10, 2021, 19:18 UTC
- Message-ID
- <60e9f28885c5a_7ef2081e@natae.notmuch>
- In-Reply-To
- <87h7h2mqgm.fsf@osv.gnss.ru>
Sergey Organov wrote:
Show 27 quoted lines
> Martin <git@mfriebe.de> writes: > > > 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. > > I think it's more because of too technical and thus confusing name for > it rather than the state itself. In fact this could be described as > "being on unnamed branch", as if HEAD points to a branch with empty > name, and is not detached in any sense. > > It's nice that once you are on unnamed branch, nothing actually changes, > so no any mental shift is needed to get out of this "state". BTW, > unnamed branch could probably even start to have entries in the reflog. > > Overall, I think Git needs to move into direction of getting rid of > "detached head" in favor of "unnamed branch" at least at the UI level.
I agree. But UI changes in git are pretty much impossible (although not 100%).
> Getting back to "git switch", if the above sounds reasonable, "--detach" > is a bad choice for the option name in the first place.
True. Maybe --unamed.
-- Felipe Contreras