git-diff-2dot-vs-3dot-merge-safetylisted
Install: claude install-skill wan-huiyan/agent-traffic-control
# Git Diff 2-dot vs 3-dot — Merge Safety Assessment
## Problem
You're reviewing a PR before merging and run `git diff origin/main..pr-branch --stat`.
The output shows files being **deleted** — files that just landed on `main` via another
PR yesterday and that you absolutely don't want to lose. Looks like merging this PR
will wipe them out.
It won't. The 2-dot diff is showing the **symmetric difference between two trees**, not
"what the branch will change about main." Files added to main AFTER the PR's branch
point appear in the diff as "deletions" simply because the branch's tree doesn't have
them yet. GitHub's 3-way merge will preserve them.
Same trap appears when assessing a "divergent" local commit: `git log main..origin/main`
may show commits "missing" that are actually present under a different SHA (squash
merges produce new hashes; rebases rewrite history).
## Context / Trigger Conditions
Any of these:
1. **PR review:** `git diff origin/main..pr-branch --stat` shows file deletions, BUT
`gh pr view N --json mergeable,mergeStateStatus` returns
`{"mergeable":"MERGEABLE","mergeStateStatus":"CLEAN"}`.
2. **Divergent local branch:** `git status` says "Your branch and 'origin/main' have
diverged, and have N and M different commits each, respectively." But you don't
recall making real local commits.
3. **Suspicious orphan commit:** `git log origin/main..local-branch` shows a commit
you'd expect to be on origin already (e.g., an `[auto-docs]` commit from a