git how to revert the last commit code example
Example 1: git undo last commit
$ git reset --soft HEAD~1
Example 2: git undo last commit
git reset --soft HEAD~1
Example 3: git revert all commits to pervious commit
git revert --no-commit <commithash>..HEAD #revert changes in range of commits from head to back to that commit hash
Example 4: how to undo commit
git reset <commitId>
# Exemple
git reset 5310517