To get your HEAD back in the right place:
git reflog
to get a list of where HEAD has been lately.
git show sha1
to find the spot you want your HEAD to be.
- Once you find the commit you want,
git merge
to get your master back into the right spot.
Some explanation: In a git
commit there is nothing pointing one commit to the one that happend after it. When you reset the HEAD, you pointed it to an older commit. Your previous head is now dangling without anything pointing to it.
We use reflog
to see where HEAD has been lately. Once it is set back to where you want it, you point the master, or some other, branch back to that spot and all is well!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…