This error occurs when you attempt a cherry-pick while conflicts from a previous merge or cherry-pick remain unresolved. You must resolve or abort the pending operation before starting a new one.
This error indicates that Git is blocking a new cherry-pick operation because your repository is in the middle of resolving a previous conflict. When a merge, cherry-pick, or rebase encounters conflicts, Git pauses and waits for you to manually resolve those conflicts before continuing. The "unmerged files" mentioned in the error are files that contain conflict markers (<<<<<<, =======, >>>>>>) from a prior operation that hasn't been completed. Git tracks this state using special references like CHERRY_PICK_HEAD or MERGE_HEAD, which indicate an operation is in progress. Until you either resolve these conflicts and commit them, or abort the pending operation entirely, Git will refuse to start any new operation that could introduce additional conflicts. This prevents the confusing situation of having multiple overlapping conflict states.
First, identify what operation is in progress and which files have conflicts:
git statusLook for sections like "Unmerged paths" which lists files with conflicts, and messages indicating "You have unmerged paths" or "Cherry-pick currently in progress."
List all unmerged files to see exactly what needs to be resolved:
git diff --name-only --diff-filter=UThis shows only files with unmerged (U) status. You can also use:
git ls-files -uto see the unmerged entries in the index.
Open each conflicted file and look for conflict markers. The format is:
<<<<<<< HEAD
Your current branch's version
=======
The incoming change (from cherry-pick)
>>>>>>> commit-hashEdit the file to keep the code you want, removing all conflict markers. You can also use a merge tool:
git mergetoolOr accept one side entirely:
# Accept your version (current branch)
git checkout --ours <filename>
# Accept the incoming version (cherry-picked commit)
git checkout --theirs <filename>After resolving conflicts in a file, mark it as resolved by staging it:
git add <filename>Or stage all resolved files at once:
git add .Verify that all conflicts are resolved:
git statusThe "Unmerged paths" section should be empty.
Once all conflicts are resolved and staged, continue the cherry-pick:
git cherry-pick --continueGit will open your editor for the commit message. Save and close to complete the operation.
If you want to cancel the cherry-pick and return to the state before it started:
git cherry-pick --abortThis discards all conflict resolution work and restores your branch to its previous state. Your local uncommitted changes are preserved.
If you're cherry-picking multiple commits and want to skip just this one:
git cherry-pick --skipThis skips the current commit and moves to the next one in the sequence. Use this only if you're certain you don't need this particular commit's changes.
If git cherry-pick --abort doesn't work, you can manually clear the cherry-pick state:
# Remove the cherry-pick state files
rm .git/CHERRY_PICK_HEAD
# Reset to clean up the index
git reset --hard HEADWarning: git reset --hard will discard ALL uncommitted changes. Only use this as a last resort when other methods fail.
Using merge strategies during cherry-pick: You can apply cherry-picks with specific merge strategies to handle conflicts automatically:
# Favor the cherry-picked changes on conflict
git cherry-pick -X theirs <commit>
# Favor your current branch on conflict
git cherry-pick -X ours <commit>Cherry-picking multiple commits: When cherry-picking a range of commits, conflicts are more likely. Process them from oldest to newest:
git cherry-pick oldest_commit^..newest_commitIf conflicts occur, resolve each one and run git cherry-pick --continue to proceed.
Checking for in-progress operations: To see if any operation is pending:
ls .git/CHERRY_PICK_HEAD .git/MERGE_HEAD .git/REBASE_HEAD 2>/dev/nullBest practice: Commit or stash your work-in-progress before starting a cherry-pick. This keeps your working directory clean and makes conflict resolution simpler.
warning: BOM detected in file, this may cause issues
UTF-8 Byte Order Mark (BOM) detected in file
fatal: Server does not support --shallow-exclude
Server does not support --shallow-exclude
warning: filtering out blobs larger than limit
Git partial clone filtering large blobs warning
fatal: Server does not support --shallow-since
Server does not support --shallow-since in Git
kex_exchange_identification: Connection closed by remote host
Connection closed by remote host when connecting to Git server