Skip to content
Docs
Cherry-Pick
Conflict Resolution

Handling Cherry-Pick Conflicts

Conflicts occur when the changes being cherry-picked can't be automatically applied to the target branch. This guide explains how to identify and resolve them.

Why Conflicts Happen

Cherry-pick conflicts typically occur when:

  • Code divergence - Target branch has different code in the same location
  • File deleted - File exists in source but was removed in target
  • Renamed files - File was renamed differently in each branch
  • Adjacent changes - Nearby code was modified in target branch

Identifying Conflicts

In recommit Dashboard

Check Cherry-Pick History for failed tasks:

StatusMeaning
✅ SuccessCherry-pick completed, PR created
❌ FailedConflict or error occurred

In GitHub

When a conflict occurs, recommit still creates a PR, but:

  • PR title may indicate conflict
  • PR may have merge conflicts
  • CI checks might fail

Resolving Conflicts

Open the Conflicted PR

  1. Go to Cherry-Pick History in recommit
  2. Find the failed/conflicted entry
  3. Click the PR link to open in GitHub

Review the Conflict

In GitHub, you'll see:

  • Conflict markers in the diff
  • Files that need resolution
  • Merge conflict indicator

Resolve Locally or in GitHub

Option A: Resolve in GitHub (Simple conflicts)

  1. Click "Resolve conflicts" button
  2. Edit the conflicted files
  3. Mark as resolved
  4. Commit the resolution

Option B: Resolve Locally (Complex conflicts)

# Fetch the cherry-pick branch
git fetch origin cherry-kit/123-v2
 
# Checkout the branch
git checkout cherry-kit/123-v2
 
# You'll see the conflicts, resolve them in your editor
# Then stage and commit
git add .
git commit -m "Resolve cherry-pick conflicts"
 
# Push the resolution
git push origin cherry-kit/123-v2

Merge the PR

After resolving conflicts:

  1. Ensure CI passes
  2. Get review if required
  3. Merge the PR

Common Conflict Scenarios

Scenario 1: Code Changed in Both Branches

Situation: Same function modified differently

<<<<<<< HEAD
function calculate(x) {
  return x * 2;  // v2 has this
}
=======
function calculate(x) {
  return x * 3;  // Original PR has this
}
>>>>>>> cherry-pick

Resolution: Decide which version is correct, or combine them.

Scenario 2: File Deleted in Target

Situation: File was removed in target branch but modified in source

Resolution:

  • If file should exist: recreate it with the changes
  • If file should be deleted: skip those changes

Scenario 3: Import/Dependency Differences

Situation: Different package versions or imports

<<<<<<< HEAD
import { something } from 'package@v2';
=======
import { something } from 'package@v3';
>>>>>>> cherry-pick

Resolution: Use the version appropriate for the target branch.

Preventing Conflicts

Keep Branches Synchronized

Regularly merge or rebase between branches:

  • Reduces divergence
  • Earlier conflict detection
  • Smaller, easier resolutions

Use Squash Merge

Squash merging creates single commits:

  • Cleaner cherry-picks
  • Fewer intermediate conflicts
  • Easier to understand changes

Small, Focused PRs

Smaller PRs mean:

  • Less code to conflict
  • Easier to resolve if conflicts occur
  • Faster review and merge

Avoid Long-Running Branches

The longer a branch lives, the more it diverges:

  • Merge frequently
  • Keep version branches updated
  • Consider feature flags instead of long branches

Automated Conflict Detection

recommit will still create PRs even with conflicts, allowing you to resolve them in GitHub's interface.

When to Skip Cherry-Pick

Sometimes a cherry-pick shouldn't happen:

ScenarioAction
Change not relevant to target versionClose the PR
Breaking change for older versionClose the PR
Dependency not availableClose the PR

It's okay to close auto-created PRs if the change shouldn't be applied to that branch.

Conflict Resolution Workflow

Cherry-pick fails with conflict


    PR created anyway


    Review the conflict

    ┌────┴────┐
    │         │
    ▼         ▼
Should     Should NOT
apply?     apply?
    │         │
    ▼         ▼
 Resolve    Close PR
 conflict


Merge PR

Getting Help

If you're stuck on a complex conflict:

  1. Check FAQ for common issues
  2. Contact support
  3. Consider closing the PR and manually applying changes

Related