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

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

 



Martin <git@xxxxxxxxxx> 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.

Getting back to "git switch", if the above sounds reasonable, "--detach"
is a bad choice for the option name in the first place.

Thanks,
-- 
Sergey Organov



[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