You are currently in a detached HEAD state. To resolve that, all you need to do is create a new branch with git branch <branchname>
or git checkout -b <branchname>
. That will leave you with a local branch you can play with, and even delete when you're done with it.
Branches in git are just pointers to commits, so if you create a new branch where you are the new branch will point to your current commit, and then you can merge it or whatnot.
Your "mistake" need not be erased, you simply created new commits on top of previous ones. You did not modify history or anything like that.
EDIT: In response to your comment, what you need to do is:
git branch temp
git checkout master # or any other branch
git merge temp
git branch -d temp
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…