Courses / GitHub
30. Reverting and resetting commits
Undoing changes safely with git revert for public history and git reset for local history adjustments.
Git / Bash
Reverting and resetting commits
Two ways to undo commits: create new commits that reverse changes (safe for shared history) or move your branch pointer (for local cleanup).
"I pushed a bad change — how do I undo it without breaking everyone else's work?"
git revert makes a new commit that undoes a specific commit; git reset moves your branch pointer (and optionally working tree) to an earlier commit, rewriting local history.
"I pushed a bad change — how do I undo it without breaking everyone else's work?"
git revert makes a new commit that undoes a specific commit; git reset moves your branch pointer (and optionally working tree) to an earlier commit, rewriting local history.