Skip to content

Try our new Crash Courses!

Become a member using the button below to hide this banner and gain access to our new Crash Courses.

Undo your last commit – Git

Summary

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

git reset --soft HEAD~1

Details

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

Exercises

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

References

Reset Demystified from the Pro Git book

Back to: Git Reference > Git Undoing Things