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

Re: [PATCH] checkout: special case error messages during noop switching

From
Martin von Zweigbergk <martinvonz@gmail.com>
Date
Jul 17, 2024, 16:05 UTC
Message-ID
<CANiSa6hs1AEp1e+o0hT55DvCwPe2EUyU1EXg1E4BKCkeuEOPvw@mail.gmail.com>
In-Reply-To
<xmqqikxnqzz4.fsf@gitster.g>
Thanks! (This is a fix for a bug I reported internally at work.)
On Tue, Jul 2, 2024 at 10:52 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 7 quoted lines
>
> "git checkout" ran with no branch and no pathspec behaves like
> switching the branch to the current branch (in other words, a
> no-op, except that it gives a side-effect "here are the modified
> paths" report).  But unlike "git checkout HEAD" or "git checkout
> main" (when you are on the 'main' branch), the user is much less
> conscious that they are "switching" to the current branch.

Yes, that's exactly what happened to me. I should have used `git restore` instead. I know that's the modern way of updating paths, so I don't know why I didn't think of it. I just verified that `git restore --ours <path>` works for restoring a conflicted file to my side.

Show 5 quoted lines
> [Footnote]
>
>  * Yes, the end-users are irrational.  When they did not give
>    "--ours", they take it granted that "git checkout" gives a short
>    status, e.g..

I actually did not even know that it does that :) I'm a bit surprised that it does, especially since `git checkout <non-HEAD>` doesn't seem to do that. But that's off topic.

Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 4 in “checkout: special case error messages during noop switching”
  1. checkout: special case error messages during noop switchingJunio C Hamano, Jul 2, 2024
  2. Martin von ZweigbergkJul 17, 2024
  3. Junio C HamanoJul 17, 2024
  4. Junio C HamanoJul 17, 2024

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.