git reset --soft HEAD~1

Category: Git - Core

git reset --soft HEAD~1

Undo last commit keeping changes staged

Undoes the last commit but keeps the changes staged — as if you staged but hadn't committed yet. --soft is the gentlest undo.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.