Re: Recovering from a "detached from" HEAD
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 8, 2019, 14:44 UTC
- Message-ID
- <xmqq36q36wfw.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20190108141927.a4q5fqug3ymkh5v3@x220>
Alyssa Ross <hi@alyssa.is> writes:
Show 19 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.
I wrote not from the documentation but from what I remember about the discussion that led to final phrasing of the message, and I strongly suspect that your impression is the sign that our docs are insufficient. If you can spot where we can improve on, that would be great.
Thanks.