We are not perfect. There are may times when we make a mistake and need to revert back to the previous stage. Usually the most common way to do it would be by using
How many times have you wanted to undo your commit? Did you ever make a spelling mistake? You did the wrong commit. If so here is the answer.
There are basically two ways to do it in Git. One is using soft reset and the other one using hard reset.
This undo’s your commit and keeps changes you have made in the working tree.
git reset --soft HEAD^
This undo’s your commit and also resets your working tree to the last commit.
git reset --hard HEAD^