how to uncommit in git after commit code example
Example 1: git undo commit
git reset --soft HEAD~1
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^
Example 3: how to uncommit in git
git reset --soft HEAD^
Example 4: undo last commit
git reset --soft HEAD~1
Example 5: how to uncommit the last commit in git
git reset --soft "HEAD^"
git reset --soft "asdf"