How can I move HEAD back to a previous location? (Detached head) & Undo commits

In Git, I was trying to do a squash commit by merging in another branch and then resetting HEAD to the previous place via:

git reset origin/master

But I need to step out of this. How can I move HEAD back to the previous location?

I have the SHA-1 fragment (23b6772) of the commit that I need to move it to. How can I get back to this commit?

8 Answers
8

Leave a Comment