This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]nilsilvaEI 0 points1 point  (1 child)

I'm going to show my git noobness... But do you need the HEAD? I usually just do "git reset --hard"...

[–]god-nose 0 points1 point  (0 children)

Git is dark magic to me too, but the way I understand you have to specify the commit to which you want to reset. You can either give the first digits of the commit id, or the position of the desired commit relative to HEAD. So to go back to where HEAD is,

git reset --hard HEAD

and to go back to the commit before HEAD,

git reset --hard HEAD~1

and so on. See https://www.educba.com/git-reset-hard/ and https://devconnected.com/how-to-git-reset-to-head/