Undo last commit in git

You're in a situation where you have made a commit to a wrong branch, or for whatever reason need to undo your last commit.

git reset --soft HEAD^1
© 2023 hack nota