TheVoskamps

pr-merge-conflicts

Enumerate a GitHub pull request's actual merge conflicts against its base — the conflicting files and hunks — by trial-merging in a throwaway worktree that is aborted and removed afterwards. Resolves, commits and pushes nothing; in the primary clone it fetches the head and base into the origin/* refs — or, for another repository's PR, into refs of its own that it deletes — clears only its own worktree's stale registration, touching no other worktree's, and leaves its tracked files and index as it found them.

TheVoskamps 0 Updated 1w ago
GitHub

Install

npx skillscat add thevoskamps/claude-plugins-marketplace/pr-merge-conflicts

Install via the SkillsCat registry.

SKILL.md

PR Merge Conflicts

Enumerate the conflicts a pull request's branch has with its base
branch, and nothing else. GitHub reports mergeStateStatus: DIRTY
without saying which files or hunks conflict; this skill performs the
merge in a throwaway worktree, collects what conflicts, then aborts
the merge and removes the worktree. It resolves nothing, commits
nothing, pushes nothing, and leaves the primary clone's tracked files
and index as it found them; what it does change there is the fetched
origin/* refs and its own worktree's registration, described below.

A PR of another repository than the checkout's is fetched from that
repository's https://<host>/<owner>/<repo>.git into
refs/pr-merge-conflicts/<host>+<owner>+<repo>/<N>/head and
refs/pr-merge-conflicts/<host>+<owner>+<repo>/<N>/base, the names
lowercased, which the script deletes on every exit, so no origin/*
ref changes for it. The fetch authenticates as git does for that
URL.

Invocation

/pr-merge-conflicts <PR>
  • <PR> (required): the pull request, in any form
    skills/lib/pr-reference.md lists.

Execution

Run the bundled script from inside a git checkout, spelled as a bare
name:

pr-merge-conflicts <PR>

The script reads the PR's head and base branches, fetches both, and
adds a detached worktree at the head under
.claude/worktrees/pr-merge-conflicts-<N> — for another repository's
PR, .claude/worktrees/pr-merge-conflicts-<host>+<owner>+<repo>-<N>,
lowercased — so no branch claim is taken and nothing lands in the
primary clone's working tree. It trial-merges
the base there without committing, collects the conflicting files and
each one's hunks, then aborts the merge and removes the worktree on
every exit, so a failed run leaves nothing for the next one to trip
on. A worktree an interrupted earlier run left at that path is cleared
before the add, and so is a registration of that path whose directory
is gone. The script clears only its own worktree's registration and
touches no other worktree's, so a worktree another agent is creating
while it runs survives.

Output and exit status

  • Exit 0 — stdout is the whole report. Its first line names the PR,
    its head and its base. Then either a line saying the trial merge is
    clean — the PR is not DIRTY against this base at this moment — or
    the conflicting files, one per line, followed by a === <file>
    section per file holding that file's conflicting hunks verbatim.
    Report it back as it stands: what to do about each conflict is the
    caller's to decide, and the resolution is whoever the caller hands it
    to.
  • Exit 1 — a command the script ran failed: the PR could not be
    read, the fetch or the worktree add failed, the merge failed without
    leaving a conflicted file, or a later git step failed. Stderr
    names the step, with the tool's own error above it where the tool
    printed one. Surface it verbatim.
  • Exit 2 — a usage error; nothing was read or created.

Categories