How to revert last X commits?
Written on by Mandeep Singh in Mistakes Correction
git reflog
# you will see a list of every thing you've done in git, across all branches!
# each one has an index [email protected]{index}
# find the one before you broke everything
git reset [email protected]{index}
# magic time machine
You can use this to get back stuff you accidentally deleted, or just to remove some stuff you tried that broke the repo.