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

Bug: `git switch --detach` gives inapplicable advice

From
mirth hickford <mirth.hickford@gmail.com>
Date
Mar 30, 2024, 07:49 UTC
Message-ID
<CAKcCxfAVGr2QoaXiT81gVZ0mfq3zJs7TywRhJzevwKX7wChJ4w@mail.gmail.com>

Is this a bug? "Your branch can be fast-forwarded" doesn't apply to a detached HEAD.

> git switch main
> git reset --hard origin/main~1
> git switch --detach main
HEAD is now at 5a07c3bde Refactor...
Your branch is behind 'origin/main' by 1 commit, and can be fast-forwarded.
  (use "git pull" to update your local branch)
> git pull
You are not currently on a branch.
Next: Junio C Hamano
Message 1 of 4 in “Bug: `git switch --detach` gives inapplicable advice”
  1. mirth hickfordMar 30, 2024
  2. checkout: do not bother "tracking" report on detached HEADJunio C Hamano, Mar 30, 2024
  3. M HickfordApr 5, 2024
  4. Junio C HamanoApr 5, 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.