← ClaudeAtlas

pr-conflict-from-mid-flight-mergeslisted

Diagnose and resolve a GitHub PR that flips to CONFLICTING / DIRTY (or "This branch has conflicts that must be resolved") because OTHER PRs landed on `main` while this PR was open. Use when: (1) a PR was clean when opened but is now CONFLICTING after hours/days, (2) `gh pr view N --json mergeStateStatus` returns DIRTY / mergeable CONFLICTING, (3) the feature branch has accumulated commits whose content is already on main via a different PR (squash-merged with a different SHA), (4) you need to figure out WHICH PRs landed and which of YOUR commits are now redundant before rebasing. Prescribes a 6-step recipe: gh status → list landed commits → detect redundant cherry-picks → reset to origin tip → rebase → reconcile.
wan-huiyan/agent-traffic-control · ★ 2 · Code & Development · score 79
Install: claude install-skill wan-huiyan/agent-traffic-control
# PR Conflict from Mid-Flight Merges ## Problem You opened a PR, it was clean and mergeable. While reviewers/CI/you were elsewhere, **other PRs landed on `main`** that touched some of the same files. Your PR now shows `mergeStateStatus: DIRTY` / `mergeable: CONFLICTING` on GitHub, with a "This branch has conflicts that must be resolved" banner. A naive `git rebase origin/main` may try to replay 14+ commits that aren't really yours — including commits that were squash-merged into main under different SHAs, or commits that someone else cherry-picked onto your branch. You need to (a) identify the actual delta, (b) drop redundant local commits before rebasing, and (c) reconcile any incidental cross-PR additions in a follow-up commit. ## Context / Trigger Conditions All four hold: 1. PR was clean when opened or last pushed. 2. `gh pr view N --json mergeable,mergeStateStatus` now returns `mergeable: "CONFLICTING"` and `mergeStateStatus: "DIRTY"`. 3. `git log --oneline $(git merge-base HEAD origin/main)..origin/main` shows ≥ 1 commit on main since your branch point. 4. `git diff --name-only $(git merge-base HEAD origin/main)..origin/main` shows files that overlap with your PR's changes. Adjacent symptom that strengthens the diagnosis: `git log --oneline HEAD~5..HEAD` shows commits you don't recognize ("docs: changelog entry for v3.1.0..." when you only meant to add a README fix) — this means a sibling branch's work got pulled into your local feature branch via checkout-with-mo