Undo a cherry-pick
How do I undo a git cherry-pick?
Short answer
If it's still in progress, git cherry-pick --abort restores everything. If it completed, git reset --hard HEAD~1 removes the resulting commit — or git revert it if you've already pushed.
git cherry-pick --abort
Cancels an in-progress cherry-pick and restores the previous state
Does this match your situation?
- You cherry-picked the wrong commit.
- A cherry-pick stopped with conflicts you don't want to resolve.
- The picked commit brought in changes that don't belong on this branch.
Step-by-step fix
Still mid-cherry-pick? Abort
If conflicts stopped it and no commit was created, aborting rewinds everything to before you started. Nothing is lost.
step 1git cherry-pick --abortSkip just one commit of a range
When picking a range and only one commit is a problem, skip that one and let the rest continue.
step 2git cherry-pick --skipCompleted but not pushed? Reset it away
A finished cherry-pick is an ordinary commit at the tip of your branch, so removing it is an ordinary reset.
step 3git log --oneline -3 git reset --hard HEAD~1 # picked several? go back that many: git reset --hard HEAD~3--hard discards uncommitted changes too. Stash first if you have any.
Already pushed? Revert instead
On a shared branch, add a commit that undoes the change rather than rewriting what others have already pulled.
step 4git revert HEAD git pushRecover if you reset too far
The reflog has every position your branch held, so an over-eager reset is a one-line fix.
step 5git reflog git reset --hard HEAD@{1}
Why this works
Cherry-pick creates a brand-new commit that happens to contain the same changes as another one — it is not a link or a reference to the original. That means the result is structurally indistinguishable from a commit you wrote by hand, and every ordinary undo applies: abort while it's in progress, reset while it's private, revert once it's public. The original commit on its own branch is never affected by any of this.
How to stop it happening again
- Check the commit before picking it: git show <hash>.
- Use -n to stage without committing, so you can inspect the result first.
- Prefer merging or rebasing whole branches when you want everything — cherry-picking is for isolated commits.
Commands used in this guide
git cherry-pickCopy one specific commit onto your current branch.
git resetMove the current branch pointer, optionally rewriting the index and your files.
git revertCreate a new commit that undoes an earlier one, leaving history intact.
git reflogThe undo history for everything - the single most important recovery command.
Still stuck?
Search the full command reference and every other rescue guide — there are 56 of them, covering everything from detached HEAD to force-push disasters.
Browse all guides →Frequently asked questions
How do I cancel a cherry-pick in progress?
git cherry-pick --abort. It restores your branch and working directory to exactly the state before the cherry-pick began, discarding any partial conflict resolution.
How do I remove a commit created by a cherry-pick?
If it hasn't been pushed, git reset --hard HEAD~1 drops it. If it has been pushed to a branch others use, git revert HEAD instead so history stays valid for everyone.
Does undoing a cherry-pick affect the original commit?
No. Cherry-pick copies the change into a new commit with a different hash; the original stays untouched on its own branch and can be picked again later.
Related rescue guides
How do I undo the last commit but keep my work?
git reset --soft HEAD~1 removes the commit and leaves every change staged, ready to recommit. Use --mixed (the default) if you also want the changes unstaged, and only use --hard if you genuinely want the work destroyed. If the commit is already pushed, revert it instead of resetting.
Read the fix →Always fixableHow do I undo a commit that's already on the remote?
On a shared branch, use git revert <hash> — it adds a new commit that reverses the change, so nobody else has to do anything. Rewriting with reset plus a force-push is only appropriate on a branch you're certain nobody else has pulled.
Read the fix →Usually recoverableMy rebase went wrong and my commits are gone — how do I get them back?
The pre-rebase commits are still in the object database. git reflog shows the position from before the rebase started, and ORIG_HEAD is a shortcut to it — git reset --hard ORIG_HEAD usually restores everything in one command.
Read the fix →Always fixableHow do I remove a single commit without losing the ones after it?
Mark it drop in git rebase -i and Git replays everything except that commit. On a shared branch, git revert is the safe alternative — it neutralises the change without rewriting anyone's history.
Read the fix →