Re:A List Apart: Get started with Git
by jrockway on Tuesday November 02, 2010 @07:52PM
(#1862947)
And of course, you can still commit there and give it a name later. Hack, then cleanup. That's the git model.
[ Parent
| on HN ]
I figured this out eventually. However, when I first switched to git (and before I had tools to show my branch in my prompt), I managed more than once to make 3-4 commits on a detached head, and finding out how to fix that between the documentation and/or Google was essentially impossible. Once I simply gave up and re-did the work. The other time I figured out how to fix it, at the cost of about 3 hours of research and (eventually) questions on the IRC channel.
It's a powerful tool, and the docs are fine if you are an expert who already knows what you're looking for. I'll submit that it can be incredibly hard for a noob to learn to use correctly.
Just don't do a GC, while you have dangling commits.
You're fine as long as the detached head is newer than two weeks old. (And you might be fine past that point. While the branch is "unnamed" it does have a ref in the reflog pointing at it.)