Git Reflog: Your Local Time Machine
Reflog is Git’s local time machine.
It records moves of HEAD, so you can recover after resets, rebases, and other “oh no” moments.

The rescue flow
git reflog
git reset --hard HEAD@{3}
Use the index from before things broke. That’s the whole trick.
Next
For more “I messed up” recipes in plain English: