how to back last commit in git code example
Example 1: roll back last commit in git
git reset --soft HEAD~1
Example 2: how to revert back to previous commit in git
git reset --hard 0d1d7fc32
git stash
git reset --hard 0d1d7fc32
git stash pop
Example 3: git revert commit
git reset --hard 56e05fced
git reset --soft HEAD@{1}
git commit -m "Reverting to the state of the project at f414f31"
Example 4: revert last commit
git reset HEAD~
Example 5: how to revert to log in git
git revert --no-commit 0766c053..HEAD
git commit
Example 6: revert last commit git
$ git commit -m "Something terribly misguided"
$ git reset HEAD~
[ edit files as necessary ]
$ git add .
$ git commit -c ORIG_HEAD