resolve-conflicts
/jig:resolve-conflictsTyped in Claude Code. In Codex, ask for the jig:resolve-conflicts skill by name.
Resolves a stopped merge, rebase or cherry-pick: names each side by role, traces why each side changed, regenerates lockfiles and generated files (those the repository lists in its configuration or declares in its change-area catalog), records every decision in the commit message, checks that no change was silently dropped, verifies staged work belongs to the operation, and applies repository obligations to the whole resolved diff; replays past merges to report where they conflicted, why, and the change that removes each cause
Works with · Deliver a change Runs in drive-pr’s conflict round; fix-ci takes over for checks that fail after the merge
Run these commands in Bash or PowerShell with Bun and Git available to the command tool. The shared command runner writes the checked commit message to a file only after validation succeeds; commit that file after the command exits successfully.
A merge can finish without conflict markers and still lose a change, pick up
another session’s staged work, or break a repository rule in a file Git
merged cleanly. /jig:resolve-conflicts checks the entire resolution before
the operation is concluded, so reviewers can see what was kept and why.
The skill needs Git 2.41 or newer, to reconstruct the automatic result and to
read attributes from the index. It
handles stopped merges, rebases, cherry-picks and reverts. Picking or reverting
a merge commit with -m requires manual resolution and validation; Git does
not reliably retain the selected parent, so the mapper refuses to certify it.
Merge commits recreated by a rebase using --rebase-merges are supported. It names
the role of each side, maps the conflicts, regenerates derived files, records
decisions, and checks for dropped changes. The
agent procedure gives the commands and exit codes.
A base that was squash-merged beneath the branch
A pull request built on another pull request’s branch holds that branch’s
commits. When the branch below lands by squash or rebase, its changes reach
the new base as different commits, and an ordinary merge of the new base
reports conflicts that are only echoes of them. start-merge.ts, the
skill’s first step for bringing a branch up to date, reads from the forge
which branch the pull request was moved off and which pull request landed
it, and then merges with the point where the branch left the earlier base
as the merge base, so only the branch’s own changes can conflict. The merge
commit’s message records the earlier branch and the merge base. Without that
evidence, the step runs Git’s ordinary merge.
When resolving a base merge inside a drive, the skill refreshes dependencies before validation if the staged merge changes a package manifest or lockfile. The resolution record includes the frozen install command.
Staged changes belong to the operation
check-resolution.ts checks every staged path against the operation’s
changed-file set. Unrelated staged work blocks conclusion, with the path
and remediation in the report. Preserve that work outside the operation;
never discard another session’s edits to make the check pass.
For an operation-owned path without a recorded decision, its staged content
must match Git’s automatic result. A manual change needs a recorded decision,
even in a file that merged cleanly. Inspect the output of bun "<skill-dir>/../../shared/command.ts" -- git diff --cached to confirm the
hunks belong to the resolution. Blob contents, file modes and deletions all
matter; merely appearing on a changed-file list does not establish ownership.
Sequenced database migrations
When two branches add migrations at the same sequence number, the plan keeps the base branch’s series and moves the feature branch’s migrations after it. The repository’s own command rebuilds the journal and snapshots. The staged check compares the SQL and file mode at each required path to its committed input and checks the journal order, even when the conflict decision records a deletion. The base branch’s journal is taken as committed, in its own order: only the migrations added after it must follow in sequence order.
The skill detects the legacy Drizzle journal layout. For a command that
rebuilds that layout, or to declare a different migration directory, set
resolve_conflicts.sequenced_migrations.
The agent procedure gives the steps.
Repository obligations
Path-specific agent instructions may never load when Git makes an edit. Declare requirements that must survive every merge in the repository’s configuration:
resolve_conflicts:
obligations:
- check: "Changed callers still use the shared validation helper."
command: bun run check:validation
- check: "The resolved diff preserves each side's documented error handling."The agent checks each obligation against the whole staged diff, including auto-merged files and hunks, and includes the evidence and outcome in its resolution report. Optional commands run from the repository root with a deadline; failures block conclusion. Commands read files on disk, so each one runs only while every tracked file matches the staged tree, checked before every command and after the last. Submodules are compared whatever their ignore settings, and files Git is told not to compare (assume-unchanged or skip-worktree) are compared too, including those inside initialized submodules. A command that changes the staged tree or a tracked file stops the commands after it and invalidates the whole run: review the change, stage or discard it, and check again. A passing command supplements the text review. With no obligations configured, there are none to run.
See configuration for field details.
Where past merges conflicted
scripts/history.ts replays the merge commits of a range of time (the last
30 days by default) with git merge-tree, which changes nothing in the
repository, and reports the paths that conflicted most often, a cause for
each conflicting region (a lockfile, a release version, a count, a list
every change adds to, two changes to the same lines, …), the change that
removes each cause, the
conflict hotspots
and a weekly trend, as text or as merge-conflicts/v1 JSON. It needs Git 2.43
or newer, skips the merges a shallow clone cuts, and says how often each
cause was right when a sample was checked by hand. With reflection on, the
reflect skill’s hotspots operation reads that JSON and turns each hotspot
into a reflection finding whose class is its cause,
so a cause that recurs across files reaches one tracker issue through the
same escalation as every other finding; measuring again updates a finding
rather than adding one. With --propose-serialize it prints, instead of
the report, the areas of the
change-area catalog a hotspot lies
in alone, as the serialize: true lines a person would add so the
dispatcher drives their pull requests one
at a time; it writes nothing. With --rates it prints, for each path, how
many merged pull requests of the range changed it and how many of those met
a conflict before they merged (merge-conflict-rates/v1 JSON), taking the
merged pull requests from the forge in one bounded listing; the dispatcher
refreshes them once a day for each repository it starts pickups in.
The
agent procedure
has the flags and the causes, and
the commands that pass the hotspots on.
What each resolution leaves
The snapshot of an operation is overwritten by the next one, so a rebase that
stops five times kept only its last stop. scripts/events.ts runs after an
operation concludes (the skill’s Step 7 does it) and appends one line per
conflicted path to conflict-events.jsonl in git’s common directory: the
operation, the path, why it conflicted, the decision and reason, how long
the resolution took, and whether a drive-pr conflict-resolve round started
it. Every worktree of the clone shares the file and nothing commits it. It
covers the rebases, cherry-picks and reverts that
history.ts cannot replay. The
agent procedure has the fields.
Verification
The skill’s scratch-repository tests exercise unrelated staging during merges and rebases, merge-commit replay, automatic and manual changes, and repository obligations. The plugin-copy test runs the procedure from a cache outside this repository, without installed dependencies.
Source: plugin/skills/resolve-conflicts/README.mdThe agent's contract (SKILL.md)