View as Markdown

Merge Conflict Auto-Fix

Automatically resolve merge conflicts on pull requests caused by parallel development.

Overview

Conflict automation helps when one branch lands and leaves another branch no longer mergeable. Forkline focuses on getting the branch back into a reviewable state quickly.

Merge conflict flow
01 Branch drift

Base Branch Moves

A new merge to the base branch leaves the PR or MR out of date.

02 Detection

Conflict Detected

Forkline sees that the branch is no longer mergeable.

03 Resolution

Attempt Fix

The agent rebases context and resolves the conflicting files.

04 Reviewable again

Branch Updated

Resolved changes are pushed back to the branch for review.

Conflict automation focuses on getting the branch back into a reviewable state after base-branch drift.

Enabling Merge Conflict Auto-Fix

  1. Navigate to Repositories
  2. Find your repository
  3. Click Settings on the repository card
  4. Select the Automation tab in the modal
  5. Find Merge Conflict Auto-Fix
  6. Set the mode to Enable for this repository
  7. Set Maximum resolution attempts per PR
  8. Click Save

How It Works

Conflict Detection

When a pull request’s base branch advances, the provider sends an update event. If the branch is no longer mergeable, Forkline creates a resolution task.

Some self-hosted forges report only whether a branch is mergeable, never why, and that answer can still mean “the check has not finished”. Where the report is ambiguous, Forkline confirms the conflict itself by merging the two commits the forge named before starting a task, so a branch with an unsettled check is not announced as conflicting. The task then starts as soon as a real conflict is confirmed, which can take a minute or two longer than the forge’s own answer.

Draft Pull Requests

Draft (work-in-progress) pull requests are never auto-fixed, matching how auto-review skips them. A forge reports a draft branch as not mergeable even when nothing conflicts, and a draft is not meant to be merged yet.

Marking a pull request ready for review does not by itself start a conflict check. The next push to the pull request’s branch, or to the branch it targets, is what picks it up.

Resolution Process

  1. Fetch base-branch changes
  2. Identify conflicting files
  3. Analyze conflict markers and surrounding code
  4. Generate a resolution
  5. Push changes back to the PR branch

Result Comments

Starting

🔀 Merge conflicts detected with `main`

Automatically resolving conflicts in:
- src/api/users.ts
- src/utils/validation.ts

Attempt 1/3

Success

✅ Merge conflicts resolved!

Pushed commit abc1234 to your branch.

Resolved conflicts in:
- src/api/users.ts (merged function signatures)

Limitations

Merge conflict automation may not resolve:

  • Semantic conflicts where the code compiles but behaves incorrectly
  • Complex multi-file refactors
  • Conflicts that require architectural decisions

Warning: Always review the result. Automatic conflict resolution is a convenience, not a correctness guarantee.

Next Steps