Skip to content
Rewriting

Cherry-pick and revert

Copying one change, and undoing one safely.

`git cherry-pick` applies one commit's change here. Like a rebase it is a three-way merge against that commit's parent, and it produces a new commit rather than moving the old one.

`git revert` is the same machinery inverted: it merges the commit's parent onto the commit, producing a change that undoes it, and records that as a new commit.

Revert adds history rather than removing it, which is why it is the right answer on a branch other people already have. Reset and rebase are for history nobody else has seen.

Commands in this lesson

git cherry-pick
Apply the change one commit made, here, as a new commit
git revert
Record a new commit that undoes an earlier one
No account, no backend. Everything you do stays in this browser.liter8.sh