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

Re: git-switch history and checkout compatibility

From
NMNamikaze Minato <lloydsensei+git@gmail.com>
Date
Aug 1, 2023, 17:23 UTC
Message-ID
<CACmJb3wTsWdqDGrkYC0p+eB-XYBotVcFAKcXJF3ftYdiiRvEdw@mail.gmail.com>
In-Reply-To
<xmqqa5wjee25.fsf@gitster.g>
On Wed, 28 Jun 2023 at 18:39, Junio C Hamano <gitster@pobox.com> wrote:
>  * I suspect that requiring an explicit "--detach" is deliberate, as
>    they were trying to make "newbie friendlier" version of checkout.

Yes, I also believe this is deliberate. I do not think however it makes it newbie-friendly. As I said, on the contrary, I am having a hard time to get newbies to start using switch precisely because it behaves differently from checkout.

Show 6 quoted lines
>  * I am on the fence about the latter one.  While I think it is a
>    bug if "switch -" and "switch @{-1}" did not work exactly like
>    "checkout @{-1}", combined with the previous point of requiring
>    to be explicit when detaching HEAD, "switch -" that tries to go
>    back to a detached state may be justifiable---it stops you in
>    order to avoid accidental detaching of HEAD.

You are right, it may be justifiable. But unexpected behavior for both newbies and experts may not be desirable.

> Personally, I think those who are familiar with and expert enough on
> Git and do not feel uneasy working on detached HEAD can and should
> just use "checkout" not "switch/restore", but that may be just me.

Isn't checkout supposed to become deprecated at some point? Does it mean I can safely ignore the fact that switch exists and continue advocating for checkout instead? I am missing the point for the introduction of git-switch entirely then. And as you said you were not among the primary advocates to add it, I guess we should wait for someone else to reply about this?

And I still would love to have a checkout.autoDetach or switch.autoDetach option :)

In any case, thank you already for this reply <3 Minato

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “git-switch history and checkout compatibility”
  1. Namikaze MinatoJun 28, 2023
  2. Junio C HamanoJun 28, 2023
  3. Namikaze MinatoAug 1, 2023
  4. Junio C HamanoAug 1, 2023

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.