Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk6 min

Git Cherry-Pick: How to Apply Multiple Commits, Pick From Another Branch, and Resolve Conflicts

Cherry-pick multiple Git commits onto your current branch, pick commits from another branch, resolve conflicts, and choose between continue, skip, abort, and quit.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To cherry-pick several commits, check out the branch that should receive them, confirm the working tree is clean, and pass the commit IDs in the order you want them replayed: git cherry-pick <commit-1> <commit-2>. Git applies each change and normally creates one new commit per change on the current branch. The source branch’s full history is not merged. If Git stops on a conflict, resolve the affected files, stage them with git add, and run git cherry-pick --continue.

Before you start

Cherry-pick always works on the branch you have checked out. The branch you copy from is only a place to find commits, so confirm both branches before running anything.

As an Amazon Associate I earn from qualifying purchases.

  • Destination: run git branch --show-current (or git status) and confirm you are on the branch that should receive the new commits.
  • Clean tree: run git status --short. The ordinary cherry-pick operation expects no modifications relative to HEAD. If you have uncommitted work, commit it or set it aside first.
  • Commit IDs: identify the exact commits on the source branch with git log. Note their full or abbreviated hashes and the order of their changes.

Apply multiple commits

Pass each commit ID as an argument. For example, to move two changes from a feature branch onto a maintenance branch:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
git switch maintenance
git status --short
git cherry-pick <commit-1> <commit-2>

Replace the placeholders with real hashes from your repository. The command does not require a repository or history shape beyond those commits existing.

Order matters

Git replays the commits in the order you list them. If the second change depends on the first (for example, it edits a function the first change added), list the first commit first. Listing commits in the wrong order can produce conflicts that would not occur in the original sequence, or changes that compile but behave incorrectly. Use git log --reverse on the source range to see the oldest commit first when building the list.

Pick commits from another branch

Naming a branch on the command line does not mean “merge this branch.” Cherry-pick selects the commits that are reachable from the refs you name and applies their changes to the current branch. The official cherry-pick manual shows revision-set forms such as git cherry-pick ..master and git cherry-pick ^HEAD master. In both examples, the commits selected are those on master that are not on the current HEAD.

git cherry-pick ..master
git cherry-pick ^HEAD master

Inspect the set before applying it

Revision syntax depends on your repository graph, so a broad range can select more than you expect. List the candidates first:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
git log --oneline HEAD..master

Confirm that every listed commit should be replayed, and reverse the order if needed, before you run the cherry-pick command with the same range.

Handle conflicts

A conflict means Git needs a human decision about the combined result of the two versions. It does not mean the repository has lost its earlier commits.

The state Git leaves behind

According to the cherry-pick manual, the current branch and HEAD stay at the last commit that was successfully created. Git records the problematic commit in CHERRY_PICK_HEAD; the exception is when you use --no-commit. Paths that applied cleanly are updated, and conflicted paths appear in the index and working tree with conflict markers. Run git status to see which files need attention.

Resolve and continue

  1. Open each conflicted file and edit the conflict markers to produce the intended combined code. Inspect the change from the source commit and the surrounding code on your destination branch before choosing a version. Avoid selecting “ours” or “theirs” for an entire file without reviewing the change.
  2. Stage each resolved file: git add <resolved-file>.
  3. Run git cherry-pick --continue. Git creates the commit for the current change and moves on to the next one in the sequence.
  4. Repeat until git status shows no cherry-pick in progress, then run your tests on the result.

The Git merge manual also offers general conflict-inspection tools: comparing diffs, examining the changes from each side, and launching git mergetool. These help with cherry-pick conflicts too. However, after staging, continue the cherry-pick with git cherry-pick --continue. The merge-specific git merge --continue does not apply to a cherry-pick sequence.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Continue, skip, abort, or quit

These four options answer different situations and have different effects. Choose the one that matches what you want to happen to the current commit and the rest of the sequence.

Command When to use it Effect
git cherry-pick --continue You have resolved the conflict and staged the files. Creates the commit for the current change and proceeds with the rest of the sequence.
git cherry-pick --skip The current commit should not be applied to this branch. Drops that commit from the sequence and moves to the next one.
git cherry-pick --abort You want to cancel the whole sequence and return to where you started. Returns the branch to its state before the sequence began.
git cherry-pick --quit You want to stop tracking the sequence but keep the current index and working tree. Clears the sequencer state only. Commits already created stay, and the index and working tree are left as they are; this is not a rollback.

Because --quit does not undo anything, use --abort when you want to return to the starting point. Use --quit only when the current files are the result you want and you no longer need Git to continue the sequence.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Cherry-pick a merge commit

A merge commit has more than one parent, so Git needs to know which parent to treat as the baseline for the change. Use -m with the parent number:

git cherry-pick -m 1 <merge-commit>

Parent numbers begin at 1. The number is only syntax. It does not tell you which parent is correct for your situation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the mainline parent

Inspect the merge before choosing. The parent to select is the one that represents the baseline against which you want the change replayed. Use git show --summary <merge-commit> or git log --graph to see the parents and their histories, then decide which one matches your destination branch. Do not apply -m 1 by habit if the commit came from a different line of development.

Cherry-pick or merge

Cherry-pick and merge answer different questions. Merge integrates a branch’s history as a whole. Cherry-pick selects changes at the commit level and creates new commits on the current branch.

Decision axis Cherry-pick Merge
Unit of integration Selected commit changes Changes from a branch since the histories diverged
Resulting history Normally new commits on the current branch Records the relationship between histories, often with a merge commit depending on the graph and options
Typical fit A targeted fix, a backport, or a small chosen set of commits Bringing a branch’s work into another branch as a whole
Main caution Replaying changes separately can complicate later history review, and equivalent changes may already be present Requires managing the full branch integration and may involve conflict resolution

The Git workflows documentation states: “Most importantly, merging works at the branch level, while cherry-picking works at the commit level.” The same page notes that the project tries to solve as many problems as possible with merges alone, while cherry-picking remains useful in selected cases. See the gitworkflows documentation for the full context.

Check for changes already applied

Once you have replayed commits to a branch, the same change can exist on both sides of a diverged history. The git-log manual documents patch-equivalence filtering across branches. A common form that compares two branches and omits commits with equivalent patches on the other side is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
git log --oneline --left-right --cherry-pick main...maintenance

Patch equivalence is a useful signal, not a substitute for review. Two commits can have matching patches but different surrounding code, so check the actual result on the destination branch.

Version notes

  • The behavior described here follows the git-cherry-pick manual for Git 2.56.0.
  • Run git --version and compare your release with the manual for that version before relying on less common options such as --quit or -m.
  • Commands and output details can change between releases, so consult the manual for your installed version when results differ from what is described here.

The git-merge manual covers the merge-side conflict tools referenced above.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.