Skip to main content
在 Manus 中运行任何 Skill
一键导入

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

星标2
分支0
更新时间2026年7月8日 11:09

Stop a false "my PR is reverting/touching dozens of upstream files" alarm when `git diff main...<branch>` reports far more files than your commit changed, in a multi-worktree repo. Use when: (1) you're in a worktree at `<repo>/.claude/worktrees/<X>/` (or any `git worktree`), (2) `git diff main...HEAD` (3-dot) or `--stat` shows tens/hundreds of files + thousands of lines but your actual commit (`git show --stat HEAD`) touched only a handful, (3) you're about to panic about the `stale-base-pr-silently-reverts-upstream-content` trap or block your own merge. Root cause: the LOCAL `main` ref is stale — it's parked many commits behind `origin/main` (often checked out in the PRIMARY worktree, which nobody pulled), so the merge-base of (local main, your branch) is ancient and the 3-dot diff includes every file that landed on origin/main since. The REAL PR diff is against `origin/main`. Verify with `git diff origin/main...HEAD --stat` (after `git fetch`) and `gh pr view <N> --json files`. Sibling of git-diff-2dot-vs-3

安装

用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。

SKILL.md
readonly