AI Merge Conflict Resolver
Resolve merge conflicts with AI using a safe temp branch that never touches your real branch until you approve.
AI Merge Conflict Resolver
The resolver uses an AI agent to automatically resolve merge conflicts. It works on a temporary branch so your real branch is never modified until you explicitly approve the result.
How It Works
- Create temp branch — Codemux creates
bot/resolve-{source}-into-{target}-{timestamp}from your current branch - Start the merge —
git merge {target}runs on the temp branch, producing conflict markers - AI resolves — The configured CLI tool (Claude Code, Codex, or OpenCode) reads each conflicted file, resolves the markers, and
git adds the resolved files - Review — You see the full diff of what the AI changed. The original files with conflict markers vs. the resolved output.
- Approve or reject:
- Approve — The temp branch is merged back into your original branch, then deleted
- Reject — The temp branch is deleted. Your original branch is untouched. Nothing happened.
Safety Guarantees
- Your original branch is never modified during resolution
- The temp branch is always deletable — it's throwaway
- You review the full diff before anything is applied
- Abort at any point returns you to exactly where you started
- No force-pushes, no branch deletions, no destructive operations
Resolution Strategies
Configure in Settings > Git > AI Tools:
| Strategy | Description |
|---|---|
| Smart merge | Understand the intent of both changes and write the optimal resolution (default) |
| Keep both | Preserve all functionality from both sides — combine changes so nothing is lost |
| Prefer my branch | Keep current branch changes as baseline, carefully integrate theirs |
| Prefer target | Keep target branch changes as baseline, carefully integrate ours |
Configuration
In Settings > Git > AI Tools > Merge Conflict Resolver:
- Enable/disable — Toggle the "Resolve with AI" button
- CLI tool — Claude Code, Codex, or OpenCode
- Model override — Leave empty for the CLI default, or specify a model (e.g.,
opus,sonnet) - Strategy — Default resolution approach
Using the Resolver
- When conflicts are detected in the Changes panel, a red Conflicts section appears
- Click Resolve with AI at the bottom of the section
- Watch the progress: creating branch → resolving → review
- In review mode: Approve to apply, Reject to discard, or edit files manually first
- After approval, the merge is complete and the temp branch is cleaned up
Per-File Resolution
You can also resolve conflicts manually alongside the AI:
- O (Ours) — Accept your version:
git checkout --ours <file> && git add <file> - T (Theirs) — Accept their version:
git checkout --theirs <file> && git add <file> - Resolved — Mark as resolved after manual editing:
git add <file>
Local Branch Merge
In addition to AI-powered conflict resolution, Codemux supports direct local branch merging from the Changes panel.
How It Works
The "Against [base]" section in the Changes panel shows how your branch differs from the base branch. A merge button in the section header lets you merge the base branch into your current branch — the safe direction for keeping your feature branch up to date.
- Click the merge icon next to the file count in the "Against" section
- Codemux runs
git merge --no-ff <base>in the workspace directory - Three outcomes:
- Merged — New commits from the base branch are integrated. A green confirmation appears.
- Already up to date — The base has no commits your branch doesn't already have.
- Conflicts — The merge pauses with conflict markers. The same Conflicts section appears with all resolution options: per-file Ours/Theirs buttons, manual editing, or AI resolution.
- After resolving all conflicts, click Complete Merge in the merge banner
- To cancel at any time, click Abort to restore your branch to its pre-merge state
Safety
- Only merges base INTO your branch (never the reverse)
- Refuses to run on a dirty working tree — commit or stash first
- Abort always restores your branch to exactly its pre-merge state
- Works with the same conflict resolution UI as the AI resolver
Merge Into Main
For solo developers who want to land feature branches without creating a PR, Codemux provides a safe "Merge into [base]" flow. It uses the same temporary resolver branch pattern as the AI conflict resolver — main is never modified until the merge is proven clean.
How It Works
- In the "Against [base]" section, click the arrow-up icon (next to the pull-updates merge icon)
- A confirmation dialog appears showing the source and target branches, with a checkbox to delete the feature branch after merge
- Codemux creates a temporary branch from the base:
merge/{feature}-into-{base}-{timestamp} - Your feature branch is merged INTO the temp branch (not into main directly)
- Three outcomes:
- Clean merge — Main is updated to include the merge commit, temp branch is deleted. You stay on your feature branch (or if "delete branch after merge" was checked, Codemux switches you to the main workspace automatically). Done.
- Conflicts — You stay on the temp branch. A blue merge banner shows "Merging [feature] into [base] — N conflicts". Resolve with the same Ours/Theirs/AI tools. After resolving, click Complete Merge to update main.
- Already up to date — Nothing to merge. No temp branch created.
Worktree Support
Merge into main works from worktrees — the common Codemux setup where main is checked out in one workspace and feature branches live in separate worktrees. The merge updates the main branch ref directly without needing to check it out, so there's no conflict with the main workspace.
Post-Merge Cleanup
When "delete branch after merge" is enabled, Codemux automatically:
- Deletes the feature branch
- Finds or creates a workspace for the base branch
- Switches to that workspace
- Closes the now-empty feature workspace
If no workspace exists for the base branch, one is created at the project root. If workspace creation fails, you stay on the current workspace (on a detached HEAD) with an error notification.
Safety Guarantees
- Main is never in a dirty or conflicted state — all conflict resolution happens on the disposable temp branch
- The main branch ref is updated atomically — if the base has diverged since the temp branch was created, the merge is rejected instead of overwriting history
- Abort at any time returns you to your feature branch with zero changes to main
- The temp branch is automatically cleaned up on complete or abort
- Optionally delete the feature branch after a successful merge
When to Use This vs PRs
| Workflow | Use when |
|---|---|
| Merge into main | Solo developer, personal projects, no review needed |
| Pull request | Team projects, code review required, CI checks needed |
| Merge main into current | Updating your feature branch with latest main (either workflow) |
Ours vs Theirs on the Temp Branch
When resolving conflicts during a "Merge into main" flow, the perspective is from the temp branch (which was created from main):
- Ours = main's version (the temp branch base)
- Theirs = your feature branch's version (being merged in)
This is the opposite of "Merge main into current" where ours = your branch and theirs = main.