undo commit
# KEEP CHANGES
git reset --soft HEAD~1
# REMOVE CHANGES
git reset --hard HEAD~1
Lively Leopard
# KEEP CHANGES
git reset --soft HEAD~1
# REMOVE CHANGES
git reset --hard HEAD~1
# Reset the index and working tree to the desired tree
# Ensure you have no uncommitted changes that you want to keep
git reset --hard 56e05fced
# Move the branch pointer back to the previous HEAD
git reset --soft HEAD@{1}
git commit -m "Reverting to the state of the project at f414f31"
git revert <commit hash>
git revert --no-commit <commithash>..HEAD #revert changes in range of commits from head to back to that commit hash
git revert --no-commit 0766c053..HEAD
git commit
git reset 'HEAD@{1}'