how to de-commit on terminal code example
Example 1: undo commit
# KEEP CHANGES
git reset --soft HEAD~1
# REMOVE CHANGES
git reset --hard HEAD~1
Example 2: how to uncommit my last commit in git
git reset --soft HEAD^
git reset HEAD^
//And if you actually want to completely undo it, throwing away all uncommitted changes, resetting everything to the previous commit (as the original question asked):
git reset --hard HEAD^