Skip to content

Help us create more tutorials! Make a donation using the Donate button or become a member using the button below to hide this banner and track your progress.

Undo your last commit – Git


To undo your last commit, enter the following command in your terminal:

git reset --soft HEAD~1


The command above will undo your last commit but keep the changes in staging.


Run the command from the Summary to undo your commit from the previous exercise.


Reset Demystified from the Pro Git book

Back to: Git Course > Git Undoing Things