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

Re: Recovering from a "detached from" HEAD

From
Alyssa Ross <hi@alyssa.is>
Date
Jan 8, 2019, 14:19 UTC
Message-ID
<20190108141927.a4q5fqug3ymkh5v3@x220>
In-Reply-To
<xmqq8szw8d8o.fsf@gitster-ct.c.googlers.com>
Show 15 quoted lines
> The commit the message shows is meant to indicate where your unnamed
> branch diverged at named branches.  Immediately after moving to the
> unnamed branch by detaching the HEAD, the message says "at"; the
> HEAD is pointing directly at the tip of the then-current branch and
> that is where the tip of the unnamed branch is.  You can tell from
> that message that you will not lose any commit if you were to check
> out a named branch from that state.
>
> After you make a commit on the unnamed branch, you have something to
> lose if you were to check out a named branch from that state, as the
> detached HEAD is the _only_ thing these new commits you built on top
> of the fork point.  Upon seeing "HEAD detached from 9745ede235", you
> could do "git log 9745ede235.." and see what you would end up losing
> if you were to switch to another branch without saving them first to
> a named branch.

Thank you for the detailed explanation. I was for some reason under the impression that "git status" would show the current HEAD, rather than where it was detached. Why I thought that, I don't know.

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 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.