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

Recovering from a "detached from" HEAD

From
Alyssa Ross <hi@alyssa.is>
Date
Jan 7, 2019, 16:17 UTC
Message-ID
<20190107161748.pyhgpewymdgjmgoh@x220>

If I detach my head, then use `git subtree add` to generate a commit, the output from `git status` changes from "detached at SHA" to "detached from SHA". The sha doesn't change, but HEAD has updated.

I don't understand why `git status` doesn't tell me that I'm "detached at" the sha of the new commit, but not only that, it seems to be extremely difficult to get `git status` to reflect my actual HEAD. `git checkout HEAD` doesn't change it, `git checkout NEWSHA` doesn't work.

So my question is, what's going on here? Is this intentional behaviour, or a bug? How should I get my working tree back to a normal state?

Next: Junio C Hamano
Message 1 of 4 in “Recovering from a "detached from" HEAD”
  1. Alyssa RossJan 7, 2019
  2. Junio C HamanoJan 7, 2019
  3. Alyssa RossJan 8, 2019
  4. Junio C HamanoJan 8, 2019

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.