<!-- Conflict resolution | Merget Docs · https://merget.ai/docs/conflict-resolution -->

# Conflict resolution

How Merget resolves conflicts and repairs findings on your pull request, and when it hands the work back to you.

In Queue and Autonomous modes, Merget tries to resolve conflicts and repair blocking findings while preparing a pull request. It does not repair a [Review break](https://merget.ai/docs/findings#review-findings), something the pull request breaks on its own: it reports the break and leaves the fix to the author. The run records what it found, what changed, where the fix is held or published, and what still needs a person.

## Which modes resolve conflicts

| Mode | What happens |
| --- | --- |
| Advisory | Reports conflicts and findings without changing your branch. |
| Queue | Prepares changes and publishes fixes when needed; you choose when to merge. |
| Autonomous | Prepares changes and also merges ready work under the configured policy. |

Queue and Autonomous modes require the GitHub App's Contents: write permission.

## What Merget tries

Merget checks a pull request against the code it will meet when it lands: the target branch and the changes planned ahead of it. It resolves many conflicts automatically and checks each resolution before using it. What it cannot resolve safely comes back to you.

When it cannot complete the work, Needs you names the remaining files and tells you whether to resolve them now or after another pull request merges. See [Unblock a pull request](https://merget.ai/docs/blocked-pull-requests).

A conflict in a file Merget never edits — anything under `.github/`, a `CODEOWNERS`, `.gitattributes` or `.gitmodules` file, or agent configuration — is always yours: the pull request is handed back before any automatic step runs, with the other conflicting files left for you too, since the pull request cannot land without you. See [Files outside the conflict](#files-outside-the-conflict).

### Previously resolved conflicts

Merget can reuse a resolution it already validated, and checks the result again in the current combination. The report labels a reused resolution Cache, so you can review the earlier run if needed.

### Conflicts are shown before any fix

The Merget check reports detected conflicts before publishing a fix. On the run page, select a conflict under Findings to read What was detected, Merget outcome and Conflict evidence.

The record remains after the conflict is resolved. This lets you compare the original sides with the resulting edit. GitHub review comments are updated with the result when the conflict has a location on the pull request's diff.

### Where each resolution goes

| Conflict or finding | Where the accepted fix goes |
| --- | --- |
| Against the current target branch | Onto the pull request branch as a commit that incorporates the target and resolves the problem, unless the branch is one a queue lands into ([A branch a queue lands into](#queue-branches)). |
| Depends on a pull request ahead in the queue | Into the queue's combined result, called the queue candidate. It is not pushed to your branch before the dependency lands. |
| On a stacked pull request | Held with the queue candidate until the parent permits publication or landing. A stacked pull request's base on GitHub is its parent's branch, so a conflict with the target reaches it through the parent: it is not on GitHub until the parent merges and Merget moves the pull request onto the target. A conflict with the parent's branch is on GitHub now; merge that branch, not the target. |

A resolution held in the queue candidate lands on the target inside a batch by Merget's push, or is published to your branch after the dependency lands; in a batch it lands without having been on a reviewed pull request head. See [When Merget lands by push](https://merget.ai/docs/security#push-landing).

Your branch does not receive another queued pull request's changes just because it follows it. A result can therefore say Resolved in queue candidate even though your branch has no new Merget commit.

### When the pull request ahead merges first

Once the earlier change is on the target branch, Merget can publish the held resolution to your branch against that target. If other changes moved the target too, it prepares your pull request again first.

If the dependency leaves the queue, Merget checks the changed situation again instead of publishing a fix that no longer applies. The current queue and latest run tell you what remains.

### Read the resolution result

Focus on the outcome and its explanation:

Resolved and published: the conflict's fix reached your branch; follow the resolution commit.

Resolved in queue candidate: the fix belongs to the queued combination and was not pushed to this branch.

Unresolved: the run did not produce an accepted resolution.

Resolution incomplete or Resolution recorded: an ended run does not confirm publication. Read its final outcome before assuming a fix is available.

The report keeps the recorded attempts and their results so you can review what happened. An attempt alone is not proof that a fix was accepted, verified or published. Read Merget outcome, Verification and the linked commit together. If an attempt was skipped or could not finish, the report explains why.

Under the counts, the run page says what Merget fixes in this repository, as the Merget check does: Merget fixes: every finding, non-blocking ones too (the default) or blocking findings only, and what holds the merge. Once Merget prepares pull requests, only blocking findings hold it. In Advisory mode the line adds (inactive in Advisory mode): nothing is resolved, and the blocking findings that hold the merge are yours to fix. For a pull request Merget analyses only until a maintainer approves its commit, the approval holds the merge; after it, only blocking findings do.

### Deleted files

A resolution can preserve a deletion or choose the appropriate path after a rename. Review added and deleted paths as well as changed lines in the published commit.

### Files outside the conflict

A resolution edits the conflicted files. With Edits beside the conflict set to Same-language files in [Repository settings](https://merget.ai/docs/repository-settings#analysis-policy), it may also change files of the same language in the same directory, such as the caller of a renamed function next door; by default it may not. A build that fails naming other files lets Merget widen the fix to them once. It never changes a manifest, a lockfile, anything under `.github/`, a `CODEOWNERS`, `.gitattributes` or `.gitmodules` file, or agent configuration. Every file a fix changed beside the conflict is listed on the published commit and in the check. Review the complete commit, including files that did not originally conflict.

## Repairing blocking findings

Merget can try to repair a blocking finding even when Git reported no textual conflict. For example, it may update a call to a function that another change renamed. It does not repair a [Review break](https://merget.ai/docs/findings#review-findings): what a pull request breaks on its own is its author's to fix.

If the finding is cleared, its recorded outcome says so. If it remains, the pull request stays blocked and the finding gives its location and message. A repair that depends on an earlier queued change follows the same [publication rules](#where-resolutions-go) as a conflict resolution.

A repair never makes a finding go away by removing the call it reports. If a repair clears a finding by deleting the call, commenting it out, or pointing it at a name nothing in the repository defines, Merget refuses the repair: the pull request stays blocked, the finding reads Repair refused with what the repair removed, for example "`show` in src/Printer.scala: 1 call before the repair, 0 after", and the repair step reads refused by Merget. Updating the call to a function that exists, such as the new name of a renamed function, is a repair.

### When the finding is wrong

Merget can dismiss a finding it judges incorrect. The finding reads Dismissed, names Merget as the actor and includes the reason. A dismissed finding no longer blocks the pull request; other unresolved blocking findings still do.

Review the dismissal's reason before relying on it. A dismissal is an assessment, not a passing build or test. It stays with the same finding across new pushes. If you disagree, undo the dismissal: the finding blocks again from the next run, and Merget does not dismiss it automatically again.

You can also dismiss a finding yourself with Write access, or undo an earlier dismissal. See [Dismissing a finding](https://merget.ai/docs/findings#dismiss). Required checks still apply to a batch unless the repository's configured policy or an explicit merge action allows otherwise; see [When a batch cannot land](https://merget.ai/docs/batching#when-a-batch-cannot-land).

Illustration: a broken reference across two files in the guide’s billing example.

What to look for

- #241 renames the formatter and updates the callers that already existed.
- #242 adds a caller of the old name on its own branch. The changes can merge without a textual conflict.
- The combined code calls a missing function. Updating the new call to formatCurrency repairs this example; the result still needs validation.

## Also resolve non-blocking findings

Optional fixes are on by default: Also resolve non-blocking findings is checked under Configure › Advanced › Finding and merge policies. Uncheck it and save to have Merget fix blocking findings only. The setting applies in Queue and Autonomous modes. With Merget's own build off, a non-blocking fix is pushed unverified and your CI verifies it, as it does a blocking one; with the build on, Merget verifies the fix first.

Merget may fix a finding or record No change recommended. A non-blocking finding that remains does not block a merge. See [Findings](https://merget.ai/docs/findings).

## Validation with your build and tests

By default, your CI verifies a fix Merget publishes. Setting Merget's own build to Auto or a Custom recipe runs your build and test commands before publication. The run's Verification section says which check verified the result, or why it remains not verified.

A build that runs and fails can block preparation. A build that could not run has a different outcome: Merget reports the reason and can ask your CI instead. See [Validating fixes](https://merget.ai/docs/validation).

Open a group under Advanced to change what is in it.

What to look for

- Merget's own build is Off by default; choose Auto to discover your commands, or Custom recipe to write them.
- Validation secrets for private registries are in the same group.

### What can make validation fail

Read the failing command and its output on the run. Common causes include a build failure in the combined code, a test failure, or a build command rewriting committed files. Correct the code or recipe and retry. A missing dependency or unavailable tool is reported separately as a build that could not run.

### Private dependencies

Merget's own build does not inherit credentials from your GitHub Actions environment, and it runs in an isolated environment with no access to Merget's own credentials.

For private GitHub dependencies, include the dependency repository in the same Merget GitHub App installation through Settings › GitHub › Manage on GitHub. Then an admin of the dependency must grant the consuming repository access under Repository settings › Advanced › Build and test setup › Dependency access. The dependency must also be named by the target branch's manifests. The run explains when installation access or a grant is missing. Its read-only token covers up to 500 dependency repositories that meet these requirements; anyone whose code the setup step runs can use it while the step runs. See [Dependency access](https://merget.ai/docs/repository-settings#dependency-access) and [Credentials used for validation](https://merget.ai/docs/security#validation-credentials).

For private package registries, add the credential under Validation secrets in repository settings, or Organization secrets in Settings › GitHub, with this repository selected under Delivered to. These values are available to recipe setup commands, not build and test commands. Fork pull requests do not receive them. A pull request a bot opened or pushed receives them only after a maintainer approves its commit, unless the bot is listed under Trusted bots ([Pull requests from forks and bots](https://merget.ai/docs/repository-settings#forks-and-bots)), and a run whose predicted base includes a fork or an unapproved pull request receives none.

After changing access or a secret, push or [request a new run](https://merget.ai/docs/runs#new-run). See [Validation secrets](https://merget.ai/docs/repository-settings#validation-secrets).

## Verification through your CI

When Merget publishes a fix its own build did not verify, it can stage that commit on a temporary `merget/queue/**` branch for your workflows. The queue reads Fix pushed · waiting for your CI while required checks run.

A passing result lets the pull request continue in queue order. A failed result blocks it and leaves the published fix available for inspection. Missing checks or a timeout can let it proceed not verified; the report says why.

### What it needs

Run the relevant workflows on pushes to `merget/queue/**`, and require the checks that matter on the target branch or under Required CI checks. See [Verification through your CI](https://merget.ai/docs/validation#ci).

## Lockfiles and generated files

Files produced by tools need to match the combined source. Review Merget's handling of these files in the report. For a file that stores hashes of other files, declare its regeneration command under Generated files in repository settings instead of asking Merget to guess the contents. Merget runs that command on the merged code when a merge needs the file rebuilt, for a trusted commit ([Pull requests from forks and bots](https://merget.ai/docs/repository-settings#forks-and-bots)), whether or not its own build is on; with the build off, your CI verifies the result like any other fix.

Merget recognizes build output from your git attributes and from the content of files on the target branch and the merge base, never from the pull request's own copy. A conflict in a file your git attributes mark `linguist-generated` takes the target branch's copy. Merget hands undeclared build-output conflicts back with the rule to declare: when only a file's content says it is build output, for example a minified bundle nobody declared, Merget keeps neither side's copy, and the hand-off shows the rule to add under Generated files — a regenerate command, or Keep target to take the target branch's copy — so the next run resolves it. You can also mark the files `linguist-generated` on the target branch, or resolve the conflict yourself.

If Merget asks you to regenerate a file, run the repository's normal generation command, commit the result on the pull request branch and push. See [Generated files](https://merget.ai/docs/repository-settings#generated-files).

## The commit Merget pushes

A published fix is a commit on the pull request branch. It can resolve a conflict, repair a finding, or bring a branch up to date when branch protection requires it. Merget does not overwrite a newer author commit with an obsolete preparation; a changed pull request is checked again.

The commit is Merget's own. Merget builds it from git's merge of your branch with the target and the files the run resolved or named, under Merget's identity; nothing the run wrote elsewhere reaches your branch, and a run that wrote elsewhere is blocked with the paths named.

The run links to the published commit. A queue-candidate link refers to the combined queued result and does not mean the same change was pushed to your branch.

### Forks

Publishing to a fork depends on GitHub allowing the App to update that branch. The contributor may need Allow edits by maintainers. If publication is blocked, the report remains available and the author can apply the fix themselves.

### A branch a queue lands into

Merget never pushes to a pull request whose branch is one a queue lands into: the target branch, another landing branch with a queue of its own, or a protected integration branch with a nested queue. Such a branch moves only by its queue's landings. A resolution Merget made is handed back with what to do instead. For a pull request that carries a nested queue, merge the target into the branch yourself or through a pull request into it. For a forward-port, such as `main` into `develop`, resolve on a branch of your own and open that one instead. Merget does not bring such a branch up to date either: under Require branches to be up to date before merging, update it yourself. A stack root's own branch — a stack set to fold, or a stack's parent — is updated as any pull request's is, and the batches of its queue are tested again over it.

### Pull before you push again

After Merget publishes a fix, pull the new branch state before continuing work. Review its commit alongside your own changes.

## Review what Merget changed

Open the latest run from the Merget check's Details link.

Read Outcome and any blocked reason.

In Findings, compare What was detected with Merget outcome.

For a conflict, inspect both sides and the resulting edit under Conflict evidence.

Follow Resolution commit or Run's published commit to review the complete change on GitHub.

Read Verification to see what was tested and whether anything remains unverified.

Check whether the prepared result was validated and whether the fix was published.

What to look for

- Validation says which result passed; publication identifies the pushed commit.
- Compare changes opens the source-to-prepared difference for review.

## When Merget hands the work back

The repository queue's Needs you view explains the remaining work and timing. If the conflict is with the current target, resolve it on your branch, run your checks and push. If it is only with an earlier pull request, follow the After #N instruction rather than applying a premature target-branch fix.

For temporary failures, use Retry preparation. For repeated failures, share the run link with [support](https://merget.ai/docs/help).

## Resolve for merge time

When a pull request in the middle of the queue conflicts, with `main` or with pull requests ahead of it, Merget shows it under Needs you. You can fix it the usual way: merge `main` into the branch and push (for conflicts with pull requests ahead, after they merge). That moves the pull request's head, so Merget prepares it, and the pull requests behind it, again.

Or resolve for merge time. Give the prompt to your agent, or follow it yourself:

Fetch the commit the queue will land, with the conflicts marked.

Resolve them and check the result.

Submit the resolution to Merget.

Merget checks it as it checks its own resolutions, keeps it beside the pull request, and lands it together with the pull request. The branch is never pushed to, and the pull request keeps its place in the queue. Conflicts with pull requests ahead are settled now, instead of after they merge.

Use one way or the other, not both: a push to the pull request's branch sets a submitted resolution aside.

### When it is offered

Merget offers this where every file it handed you is a text conflict it may write, and at most 50 files conflict. A file that needs a regenerate rule comes first: declare the rule, and Merget offers the rest once it has prepared the pull request again. Renamed, binary and protected files, agent instruction files at the repository root (`AGENTS.md`, `CLAUDE.md`, `CONTEXT.md` and `RESOLUTION.md`), symbolic links and submodules, pull requests from forks or stacked on another, and pull requests queued behind a fork's pull request or one that awaits a maintainer's approval are resolved on the branch.

It is offered in Queue and Autonomous mode, and only where GitHub requires the Merget check on the target branch, so that GitHub's merge button cannot land the pull request without the resolution. Where it is not offered, Resolve for merge time says why.

### How to resolve for merge time

In the repository queue's Needs you, open the pull request's Resolve for merge time. It sits after Resolve conflicts, whose steps and Copy task for coding agent work as before; for a pull request waiting on pull requests ahead, it sits under its waiting line.

Press Copy prompt for your agent and give the prompt to your coding agent, or read it under Show prompt and follow it yourself. It names the commit Merget published for the pull request, the commit the queue will land for it, with the files you resolve marked with conflict markers and the files Merget resolved itself, which you may review. The commit is on no branch: the prompt fetches it by its ref.

Resolve every conflict marker, keeping what both sides meant, and run your checks on the result. For a modify/delete conflict, keep the file or delete it.

Write the resolution as a patch against that commit:

```
git add -A
git diff --cached --no-color --no-ext-diff --no-textconv --no-renames --src-prefix=a/ --dst-prefix=b/ <commit> > "$(git rev-parse --git-dir)/merget-resolution.patch"
```

Paste the patch under Patch. Commit the patch is against is the commit Merget published, the one whose prompt you copied. If the queue moves meanwhile, the section says so: copy the new prompt and carry your resolution over before you submit. Under Why (shown on the pull request), say in a sentence how you resolved the conflicts.

Press Submit resolution, read what happens next, and confirm. The confirmation names each modify/delete file the patch leaves as it is, which keeps the side that changed it.

An agent connected to Merget can submit the same resolution with `merget_queue_action` and `resolve`; see [MCP](https://merget.ai/docs/mcp). It asks you before it does, because the resolution is recorded under your name.

### What happens to it

Merget applies the patch exactly to the commit it published and refuses one that leaves a conflict marker in a file it handed you. It then prepares the pull request with your resolution, as it prepares its own, and checks the whole result. While it does, the pull request's hand-off is replaced by Being checked in Needs you. Each resolution shows one of these states:

| State | What it means |
| --- | --- |
| Submitted | Merget has the resolution and is about to apply it to the commit the queue lands. |
| Checking | Merget is preparing the pull request with the resolution. |
| Accepted | The pull request passed Merget's checks with the resolution; it lands with it. |
| Retest failed | CI failed on a batch with the resolution. Withdraw it and resolve again, or push the branch. |
| Refused | Merget could not take the resolution; its line says why. |
| Landed | The resolution landed together with the pull request. |
| Published | The pull request had to land on its own, so Merget pushed the resolution to its branch as a merge of the target branch. |
| Dropped | The conflict changed, the branch was pushed, or the pull request left the queue, so the resolution no longer applies. |
| Withdrawn | Someone withdrew the resolution. |

If the queue changes, Merget checks whether your accepted resolution still applies. A changed conflict can return to Needs you with a new commit to resolve and a reference to your earlier submission. Follow that current hand-off rather than submitting an old patch unchanged. A conflict that cannot be resolved for merge time must be fixed on the branch; pushing the branch sets the earlier submitted resolution aside.

The resolution appears on the pull request as a Merget comment, with the reason, the diff and what the resolution leaves out of either side, and on its Merget check. The pull request's details say "Lands with a merge-time resolution of 3 files by alex", its row in the queue list carries a merge-time resolution tag, and Merge N PRs names it before you confirm. If the pull request has to land on its own by a way that cannot carry it, such as GitHub's merge API or with batching off, Merget first pushes the resolution to its branch as a merge of the target branch, after a green batch proved it, and says so.

### Who can submit and withdraw

Anyone with Write access to the repository on GitHub can submit or withdraw a resolution, from the dashboard or an agent with the Merget plugin. Withdraw takes it back before it lands: from the pull request's block in Needs you, from Being checked, or, in any state it stands in, from the pull request's details; Merget prepares the pull request without it from its next pass. One resolution stands for a pull request at a time, beside at most one [fix submitted to Merget](https://merget.ai/docs/batching#submit-a-fix): withdraw a standing resolution before you submit another.

### Limits

A resolution is a text diff of at most 1 MiB. Binary content, symbolic links and submodules are refused.

It cannot change anything under `.github/` or `.opencode/`, a `CODEOWNERS`, `.gitattributes` or `.gitmodules` file, or a root `opencode.json` or `opencode.jsonc`: the paths Merget never writes.

No file Merget handed you may keep a conflict marker.

The reason is required, at most 500 characters, with no control characters other than tabs and line breaks, and appears on the pull request.

Merget keeps a submitted diff until 90 days after the pull request closes; see [Security](https://merget.ai/docs/security).

Accept fixes and conflict resolutions submitted to Merget in the repository's [Queue behavior](https://merget.ai/docs/repository-settings#queue-behavior) settings turns this option off. Resolutions already submitted carry on to their end and can still be withdrawn; resolving on the branch works either way.
