Keep changes in working tree, only remove the last commit:
git reset --soft HEAD~1
Discard the last commit and its changes (destructive):
git reset --hard HEAD~1
Amend the last commit (change message or add more changes):
git commit --amend -m "New message"
# or stage more files, then:
git commit --amend --no-edit
If already pushed, you need to force-push after reset/amend: git push --force-with-lease (prefer over --force to avoid overwriting others’ work).