

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Revert
incomplete
2: Diff
incomplete
3: Revert vs. Reset
incomplete
This lesson's interactive features are locked, please to keep using them
git reset --soft: Undo commits but keep changes stagedgit reset --hard: Undo commits and discard changesgit revert: Create a new commit that undoes a previous commitIf you're working on your own branch, and you're just undoing something you've already committed, say you're cleaning everything up so you can open a pull request, then git reset is probably what you want.
However, if you want to undo a change that's already on a shared branch (especially if it's an older change), then git revert is the safer option. It won't rewrite any history, and therefore won't step on your coworkers' toes.
Click to play video