Watch: Undo my last commit without losing my work | Vovy
Watch Vovy do it on a Mac: "I committed the wrong thing, undo my last commit but keep the changes". Vovy checks whether the commit was pushed, then undoes it the safe way: a soft reset if local, a revert commit if others may already have it.
"I committed the wrong thing, undo my last commit but keep the changes"
Vovy checks whether the commit was pushed, then undoes it the safe way: a soft reset if local, a revert commit if others may already have it.
What happens in the video
- Look at the last commit: Vovy shows the commit's message and changed files as a diff card, so you confirm it is the one to undo.
- Check if it was pushed: Vovy compares your branch with GitHub. Undoing a pushed commit needs a different, safer method.
- Undo a local commit: If it is only on your Mac, Vovy runs git reset --soft HEAD~1, which removes the commit but keeps every change staged.
- Revert a pushed commit: If it is on GitHub, Vovy runs git revert, which adds a new commit that cancels the old one, so no history is rewritten.
- Confirm your files are safe: Vovy runs git status and shows a card of your changes still in place, ready to recommit correctly.
Read the step-by-step guideLoading...