git cherry-pick: Copy a Commit to Another Branch
git cherry-pick <commit> takes the changes from one commit and applies them as a new commit on the branch you’re on. Use it when you need one specific fix from another branch without merging everything else that’s there.
Quick answer
Switch to the branch that needs the fix, then run git cherry-pick <hash>. Add -x to note the original commit in the message.

How we tested: every command on this page was run in a real Git repository (Git 2.43) on 18 November 2026, and the output shown is copied from the terminal. Your commit hashes will differ.
A typical case
A redesign branch has three commits. One of them is a tax rounding fix that main needs today; the redesign itself isn’t ready. List the commits on the branch that aren’t on main yet:
$ git log --oneline main..feature/redesign
c094f5f New footer
6c7f7db Fix tax rounding
3a09556 New nav
Cherry-pick one commit
From main:
$ git cherry-pick 6c7f7db
[main 58db776] Fix tax rounding
Date: Wed Nov 18 11:39:00 2026 +0000
1 file changed, 1 insertion(+)
create mode 100644 tax.js
$ git log --oneline -2
58db776 Fix tax rounding
47159c9 Add homepage
The fix is on main as a brand-new commit with its own hash. The original stays on the redesign branch. When that branch merges later, Git usually recognises the change is already there, so it doesn’t apply twice.
Record where it came from with -x
On a team, add -x. It appends the source hash to the commit message, so anyone can trace the copy back:
$ git cherry-pick -x 6c7f7db
[main f2a139a] Fix tax rounding
Date: Wed Nov 18 11:39:00 2026 +0000
1 file changed, 1 insertion(+)
create mode 100644 tax.js
$ git log -1 --format=%B
Fix tax rounding
(cherry picked from commit 6c7f7db316942b42a1ca959a486c77e562fe0895)
It’s standard practice on release-branch backports: it costs nothing and answers “where did this come from?” months later.
Cherry-pick several commits or a range
List hashes to pick specific ones (they’re applied in the order you give): git cherry-pick a1b2c3d e4f5a6b. For a continuous range, there’s a catch: A..B excludes A. Put ^ after the first commit to include it:
$ git cherry-pick 3a09556^..feature/redesign
[main e426dbd] New nav
Date: Wed Nov 18 11:39:00 2026 +0000
1 file changed, 1 insertion(+)
create mode 100644 nav.js
[main 3119056] Fix tax rounding
Date: Wed Nov 18 11:39:00 2026 +0000
1 file changed, 1 insertion(+)
create mode 100644 tax.js
[main 90b223d] New footer
Date: Wed Nov 18 11:39:00 2026 +0000
1 file changed, 1 insertion(+)
create mode 100644 footer.js
$ git log --oneline -4
90b223d New footer
3119056 Fix tax rounding
e426dbd New nav
47159c9 Add homepage
If you’re picking most of a branch, a merge or rebase is usually the better tool.
When cherry-pick hits a conflict
If main changed the same lines, Git stops and marks the file:
$ git cherry-pick hotfix
Auto-merging tax.js
CONFLICT (content): Merge conflict in tax.js
error: could not apply 9c29755... Hotfix tax
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
$ git status --short
UU tax.js
UU means “both modified”. Open the file, keep the right version between the <<<<<<< and >>>>>>> markers, then git add tax.js and git cherry-pick --continue. To back out completely:
$ git cherry-pick --abort
$ git log --oneline -1
1c39f87 Refactor tax
Options worth knowing
| Option | What it does |
|---|---|
-x |
Adds “(cherry picked from commit …)” to the message |
-n / --no-commit |
Applies the changes but doesn’t commit, so you can combine or edit them |
-e |
Lets you edit the commit message first |
-m 1 |
Needed to cherry-pick a merge commit (keep the first parent’s side) |
--continue / --skip / --abort |
Resume, skip this commit, or cancel after a conflict |
Related guides
- git revert: Undo a Commit Without Rewriting History
- Git Merge Conflicts: How to Keep Ours or Theirs
- How to Squash Commits in Git (3 Ways)
- All Git commands with examples
FAQ
What does git cherry-pick do?
It copies the changes from an existing commit and applies them as a new commit on your current branch.
How do I cherry-pick a range of commits?
Use git cherry-pick A^..B to include both A and B. Without the ^, commit A itself is left out.
Does cherry-pick change the original branch?
No. The source commit stays where it is. Only your current branch gets a new commit.
How do I undo a cherry-pick?
During a conflict, run git cherry-pick --abort. After it’s done, use git reset --hard HEAD~1 if it isn’t pushed, or git revert HEAD if it is.