worktree-stale-local-main-ref-inflates-pr-diff

Diagnoses inflated git diff output caused by a stale local main ref in multi-worktree repositories.

3|Updated May 8, 2026
One-click install
npx skills add https://github.com/wan-huiyan/agent-traffic-control --skill worktree-stale-local-main-ref-inflates-pr-diff-wan-huiyan
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: worktree-stale-local-main-ref-inflates-pr-diff
Source: https://github.com/wan-huiyan/agent-traffic-control/tree/main/plugins/agent-traffic-control/skills/worktree-stale-local-main-ref-inflates-pr-diff
Command: npx skills add https://github.com/wan-huiyan/agent-traffic-control --skill worktree-stale-local-main-ref-inflates-pr-diff-wan-huiyan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? In a multi-worktree Git setup, git diff main...branch can report dozens or hundreds of changed files when your commit only touched a few, triggering a false alarm that your PR is reverting upstream work. This Skill explains that the local main ref is simply stale (parked behind origin/main in the primary worktree) and shows how to verify the real PR diff before panicking, rebasing, or blocking your own merge. ## Core Features & Use Cases - Root-cause diagnosis: Explains why the 3-dot diff against a stale local main ref over-reports files, and why the fix is diffing against origin/main after git fetch. - Verification checklist: Provides concrete commands (git show --stat HEAD, gh pr view <N> --json files, git diff --diff-filter=D origin/main...HEAD) to prove no revert is happening. - Code-review variant: Covers the case where a review subagent claims your PR carries unrelated code because it read full-file context instead of the actual hunks, with gh pr diff <N> --name-only as the authoritative check. - Use Case: Your one-commit PR touching 6 files shows a 92-file diff against main; you run the fetch-and-verify sequence, confirm GitHub reports the same 6 files with a CLEAN merge state, and merge without an unnecessary rebase. ## Quick Start Ask the assistant to check whether my PR's huge git diff against main is real or just a stale local main ref in my worktree.

Frequently Asked Questions about worktree-stale-local-main-ref-inflates-pr-diff

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does git diff main...branch show hundreds of files I never changed?▼

The 3-dot diff compares from the merge-base of your local main ref and your branch. In multi-worktree repos the local main ref is often stale, parked many commits behind origin/main, so the diff includes every upstream file changed since that old point.

How do I see the real diff my PR will merge on GitHub?▼

Run git fetch origin main, then git diff origin/main...HEAD --stat for the true diff. For ground truth, use gh pr view <N> --json files, which lists exactly the files GitHub will change.

How can I prove my PR is not reverting upstream changes?▼

Run git diff --diff-filter=D --name-only origin/main...HEAD; an empty result proves your branch deletes nothing. The merge-base ancestor check alone is insufficient because a stale tree under a current pointer can still pass it.

Why does a code review say my PR contains code I did not write?▼

Reviewers reading full-file context can mistake already-merged code on origin/main for your PR's hunks. Falsify the scope claim with gh pr diff <N> --name-only and git log origin/main..branch to confirm only your commits and files are included.

Should I fix the stale local main ref inside my worktree?▼

No. git checkout main fails from a worktree because main is already checked out in the primary worktree. Simply diff against origin/main after fetching, since that is the ref GitHub uses for the PR anyway.