Skip to main content

Merge Conflicts

A guided workflow for resolving conflicts between two branches with optional AI assistance. Initiate from branch names, a GitHub PR URL, or an Azure DevOps PR URL — Polygent attempts an automated resolution in the background and falls back to a three-pane diff editor for any files it can't resolve cleanly.

Starting a merge

You can begin a merge from three entry points:

SourceWhat you provide
Branch NamesSource branch + destination branch
GitHub PR URLA PR URL — Polygent extracts source/destination from the PR
Azure DevOps PR URLA PR URL — Polygent extracts source/destination

Only one active merge per workspace is allowed at a time.

Clean merge path

If Git can merge without conflicts:

  1. Polygent runs the merge
  2. Auto-commits the result
  3. Pushes to the destination branch (or back to the source branch when started from a PR URL)
  4. Marks the merge Completed

Nothing else needed — close the page.

Conflicted merge path

When conflicts exist:

  1. Background AI resolution — Polygent kicks off an AI session that tries to resolve every conflicted file (runs for up to 30 minutes)
  2. While the AI works, you see a "Resolving..." status
  3. Files the AI couldn't fix open in a three-pane diff editor: source, destination, merged

You can also Skip AI at any time and resolve manually.

Three-pane diff editor

For each conflicted file:

  • Left pane — source branch version
  • Center pane — destination branch version
  • Right pane — merged result (editable)

Edit the right pane until it represents the desired final state, then mark the file resolved.

Binary files

For binary conflicts (images, PDFs, compiled assets), the editor doesn't apply. Instead, choose Source or Destination to pick which version wins.

PR URL push

When the merge was started from a PR URL, the resolved commits are pushed back to the source branch (the PR branch), so the existing PR updates automatically — no need to recreate the PR.

Canceling

Cancel Merge with confirmation aborts the merge:

  • Any in-flight AI resolution is canceled
  • The worktree is cleaned up
  • The merge moves to Canceled

Merge history

Every merge attempt is logged with status, source/destination, started-by user, duration, and outcome:

StatusMeaning
In ProgressActive merge
CompletedSuccessful, pushed
CanceledAborted by user

Session hooks at merge events

Merges fire the standard session hook events for any hook configured on the merge worktree:

  • On init — when the merge worktree is set up
  • On agent finish — after each AI resolution turn
  • On done — when the merge completes
  • On cancel — when the merge is canceled

Use this to run tests on the merged result before push.

Orphaned merge cleanup

On startup, Polygent scans for merge worktrees that didn't shut down cleanly (e.g., server killed mid-merge) and cleans them up automatically. Merges still in progress past their deadline are marked failed.

Examples

Resolve a stale PR's conflicts A GitHub PR has gone stale and now conflicts with main. Paste the PR URL into a new merge. Polygent attempts an AI resolution; anything it can't resolve cleanly opens in the three-pane editor. When you finish, the resolved commits are pushed back to the PR branch — the existing PR updates, no need to recreate it.

Verify the merge before pushing Configure a hook on the merge worktree (for example, run your test suite on the on done event). After the conflict is resolved, the hook runs against the merged result so a bad merge is caught before it reaches the destination branch.

Pick a winner for binary conflicts Two branches both changed a logo image. The diff editor can't merge binaries, so choose Source or Destination to pick which version wins, then continue with the remaining text conflicts.