How do I undo the last git commit?
Ask QuestionAsked 13 hours agoViewed 2.3k times
I committed too early and want the changes back in my working tree without losing them.
PN
2 Answers
- ✓✓ Accepted answer
git reset --soft HEAD~1 keeps your changes staged so you can re-commit them cleanly.
SA For shared history, prefer git revert so you do not rewrite commits other people already pulled.
LO