My last commands were:
git rebase -i HEAD^^
git rebase -i HEAD^^
git rebase -i HEAD^^^
How do I get the repository back to the state it was in before the first of the listed commands?
NOTE: all I have been doing thus far is git commit -am "my commit message"
. I don't understand branching and merging yet so I haven't used them. I was trying to roll back the code to the previous commit, but this didn't seem to do anything.
If those are the exact commands you've run, then git reset --hard HEAD@{3}
will get you back to your HEAD as of 3 commands ago. More generally, look at the output of git reflog
to come up with the ref you want to recover, and then git reset
to that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With