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

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

 



On July 9, 2021 12:21 PM, Felipe Contreras wrote:
>Martin wrote:
>>
>> 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.
>
>Yes, and that's a good thing, but there's no need to cripple advaned users.
>
>> 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?
>
>No. As you noted it has value for beginners.
>
>> - add --allow-detach  and git config switch.detach allow ?
>
>That's a good option, but another one would be to have a core.advanced mode, you turn it on if you are an advanced user.
>
>> 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.
>
>That warning olny appears with `git checkout`, not with `git switch --detach`.
>
>> 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.
>
>That's definitely a bug.

In all of this discussion, please be aware that many CI/CD systems use sparse checkout and detached heads as a matter of efficiency and certainty. Please ensure that you are not changing the semantics of existing capabilities when restricting what `git switch` will do. I am concerned about the 280,342 (as of this minute) current Jenkins users who depend on this.

Thanks,
Randall






[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