Undo Local Git Commits Safely Using git reset and git revert

You hit enter on a commit, and half a second later you see it: a stray debug file, a bug you