how to reset to last commit code example
Example 1: git reset to commit
git reset --hard <commit id>
git reset --hard HEAD~1
Example 2: roll back last commit in git
git reset --soft HEAD~1
Example 3: git reset last commit
$ git reset --soft HEAD~1
Example 4: how to revert back to previous commit in git permanently
git reset --hard 0d1d7fc32
git stash
git reset --hard 0d1d7fc32
git stash pop
Example 5: reset last commit
$ git reset --soft HEAD~1
Example 6: reset to commit
git revert --no-commit 0766c053..HEAD
git commit