Undo the last commit but keep the changes

Bash

Moves HEAD back one commit and leaves everything staged, which is what you usually want after committing too early.

git reset --soft HEAD~1

# Keep the changes but unstage them as well:
git reset HEAD~1

More in Git

Random picks