Possible Duplicate:
Lost Last Git Commit
gitx How do I get my ‘Detached HEAD’ commits back into master
I am using GitHub for Mac. I finished committing all of my changes, then realized that I was committing to the HEAD. So I clicked on my master branch, and now all of my commits (and thousands of lines of code) have disappeared. Please help me!
Thanks.
There is always “git reflog” to find old commits.
If you have not committed anything since then
git branch old-commits HEAD@{1}
should create “old-commits” branch that contains your old commits.
Then you can merge or rebase those commits on your master.