How do I get back to where I was ... (rollback to previous commit) Git beginner

My last commands:

git rebase -i HEAD^^ git rebase -i HEAD^^ git rebase -i HEAD^^^ 

How to return the repository to the state in which it was in front of the first of the listed commands?

NOTE: all I have done so far is git commit -am "my commit message" . I do not understand branching and merging, so I did not use them. I tried to drop the code until the previous commit, but it did nothing.

+4
source share
1 answer

If these are the exact commands that you executed, then git reset --hard HEAD@ {3} will return you to your HEAD from 3 commands back. More generally, look at the output of git reflog to find the ref you want to restore, and then git reset .

+8
source

All Articles