Merge Conflict Resolver
FeaturedOn demandAbout Merge Conflict Resolver
This loop rebases the current branch onto origin/main and deals with any conflicts that appear. Each round updates the branch and then runs npm test to verify the result. It is started manually, runs at most 8 rounds and supports Cursor and Claude Code.
Key features
- 01Fetches before rebasing, so work lands on the latest origin/main
- 02Verifies the rebased code with npm test
- 03Capped at 8 rounds to stop repeated failures
- 04Supports Cursor and Claude Code
Use cases
- 01A feature branch has fallen behind main and needs the latest changes
- 02Clearing conflicts with the trunk before a merge
- 03Confirming tests still pass after a rebase
- Goal
- The branch is rebased on main with no conflicts and the tests pass.
- Exit when
- Stop when the rebase completes and npm test exits 0, or after 8 rounds.
- Between iterations run
- npm test
Launch prompt
Paste into Cursor / Claude Code. The agent repeats the steps below until the exit condition is met.
Start the "Merge Conflict Resolver" loop. Goal: The branch is rebased on main with no conflicts and the tests pass. Max iterations: 8. Step 1: Update the branch — Fetch from the remote and rebase the current branch onto origin/main. If conflicts appear, inspect each conflicted file, keep the intended changes from both sides and continue the rebase. `git fetch origin && git rebase origin/main` Step 2: Run the tests — After the rebase finishes, run npm test. An exit code of 0 ends the loop; otherwise the failures show whether a conflict was resolved wrongly or something else broke. `npm test` Step 3: Fix and retry — Edit code to address the failing tests or unresolved conflicts, then begin the next round. Between iterations run: `npm test` Exit when: Stop when the rebase completes and npm test exits 0, or after 8 rounds.
Steps
Each round runs in order; if the exit condition isn’t met, another round starts, up to 8.
Fetch from the remote and rebase the current branch onto origin/main. If conflicts appear, inspect each conflicted file, keep the intended changes from both sides and continue the rebase.
git fetch origin && git rebase origin/mainAfter the rebase finishes, run npm test. An exit code of 0 ends the loop; otherwise the failures show whether a conflict was resolved wrongly or something else broke.
npm testEdit code to address the failing tests or unresolved conflicts, then begin the next round.
Supported agents
Coding agents that can run this loop directly.