
Git diff 2dot vs 3dot merge safety
Checks whether a branch really deletes files before merge, using three-dot git diffs
Git diff 2dot vs 3dot merge safety is an open-source agent skill for developer tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.
- Scripts
- None
- Platforms
- Claude Code, Codex, Cursor
- GitHub stars
- 5
- Last commit
- License
- MIT
- Listing updated
Similar skills
About Git diff 2dot vs 3dot merge safety
This skill helps an agent judge merge risk when a pull request looks like it deletes files on main. It explains that a two-dot diff compares two trees directly, so files added to main after the branch point show up as removals, while a three-dot diff compares against the merge base and reports only what the branch itself changed.
The workflow gives the agent concrete git commands: a three-dot stat, a filter limited to deleted or renamed paths, and a check of the GitHub mergeable status as a cross-reference. It also covers divergent local branches, where the agent probes whether a local commit is already on main by cherry-picking it onto a fresh branch off origin/main and interpreting the outcome, then grepping the touched files to confirm.
It expects a git repository with an origin remote, and the GitHub CLI for the mergeable check. The notes warn that a stale local main ref can over-report, so the agent should fetch and diff against origin/main, and that an empty deletion filter does not rule out reverted content.
When your agent uses it
Two-dot `git diff origin/main..branch` reports files `main` gained after you branched as your deletions; three-dot uses the merge base and shows only real ones.
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
From a static check of its 1 file (9 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
This skill ships in the agent-traffic-control plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):
/plugin marketplace add wan-huiyan/agent-traffic-control
/plugin install agent-traffic-control@wan-huiyan-agent-traffic-controlOr copy only this skill to ~/.claude/skills/git-diff-2dot-vs-3dot-merge-safety:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/git-diff-2dot-vs-3dot-merge-safety &&
cp -R "$tmp/plugins/agent-traffic-control/skills/git-diff-2dot-vs-3dot-merge-safety" ~/.claude/skills/git-diff-2dot-vs-3dot-merge-safety &&
rm -rf "$tmp"For one project only, put the folder in .claude/skills/git-diff-2dot-vs-3dot-merge-safety inside it instead.
Copy the skill folder to ~/.agents/skills/git-diff-2dot-vs-3dot-merge-safety to use it in every repository:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/git-diff-2dot-vs-3dot-merge-safety &&
cp -R "$tmp/plugins/agent-traffic-control/skills/git-diff-2dot-vs-3dot-merge-safety" ~/.agents/skills/git-diff-2dot-vs-3dot-merge-safety &&
rm -rf "$tmp"For one repository only, put the folder in .agents/skills/git-diff-2dot-vs-3dot-merge-safety inside it instead.
Copy the skill folder to ~/.cursor/skills/git-diff-2dot-vs-3dot-merge-safety to use it in every project:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/git-diff-2dot-vs-3dot-merge-safety &&
cp -R "$tmp/plugins/agent-traffic-control/skills/git-diff-2dot-vs-3dot-merge-safety" ~/.cursor/skills/git-diff-2dot-vs-3dot-merge-safety &&
rm -rf "$tmp"For one project only, put the folder in .cursor/skills/git-diff-2dot-vs-3dot-merge-safety inside it instead.
Run in a terminal (add --scope workspace to install it for the current workspace only):
gemini skills install https://github.com/wan-huiyan/agent-traffic-control.git --path plugins/agent-traffic-control/skills/git-diff-2dot-vs-3dot-merge-safetyOr copy the folder to ~/.gemini/skills/git-diff-2dot-vs-3dot-merge-safety yourself.
For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/git-diff-2dot-vs-3dot-merge-safety:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/git-diff-2dot-vs-3dot-merge-safety &&
cp -R "$tmp/plugins/agent-traffic-control/skills/git-diff-2dot-vs-3dot-merge-safety" ~/.copilot/skills/git-diff-2dot-vs-3dot-merge-safety &&
rm -rf "$tmp"For one project only, put the folder in .github/skills/git-diff-2dot-vs-3dot-merge-safety inside it instead.
Get the folder:
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.gitThen copy agent-traffic-control/plugins/agent-traffic-control/skills/git-diff-2dot-vs-3dot-merge-safety into your agent's skills folder as git-diff-2dot-vs-3dot-merge-safety. Agents that support SKILL.md read one folder per skill.
What it does
- Two-dot versus three-dot diff
- Explains why a two-dot comparison reports files added to main after branching as deletions.
- Deletion check command
- Provides a three-dot diff filtered to deleted and renamed paths to confirm what a branch removes.
- Divergent commit probe
- Walks through cherry-picking a local commit onto a fresh branch to see if its content already exists on main.
- Empty cherry-pick interpretation
- Describes how to read git output to tell redundant commits from real conflicts or missing content.
- Stale ref pitfalls
- Warns that an outdated local main ref can inflate three-dot results and recommends fetching first.
Good for
- Check whether a pull request will delete files already on main
- Find out if a local commit is already present on origin/main under a different hash
- Safely reset a local main branch to origin/main after verifying content
- Confirm a squash-merged change is on main before discarding a local branch
Git diff 2dot vs 3dot merge safety FAQ
Why does a two-dot diff show files as deleted?
A two-dot diff compares the tips of two trees, so files added to main after the branch point appear as removals because the branch's tree does not contain them yet.
Which command shows only what a branch actually deletes?
A three-dot diff filtered with --diff-filter=DR and --name-only lists deleted and renamed files relative to the merge base.
Does an empty deletion list mean no content was lost?
No. The filter only catches removed files, so reverted content can still appear as line removals in the full three-dot diff and should be read directly.
How do I tell an empty cherry-pick from a real conflict?
An empty pick reports that the working tree is clean with nothing to commit after conflicts are marked fixed, meaning the content already exists on main.
How do I install Git diff 2dot vs 3dot merge safety in Claude Code?
Copy the skill folder from GitHub to ~/.claude/skills/git-diff-2dot-vs-3dot-merge-safety to use it in all your projects, or to .claude/skills/git-diff-2dot-vs-3dot-merge-safety in one project. Or install the agent-traffic-control plugin, which includes it: /plugin marketplace add wan-huiyan/agent-traffic-control, then /plugin install agent-traffic-control@wan-huiyan-agent-traffic-control.
Does Git diff 2dot vs 3dot merge safety run scripts?
No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.
Which AI agents can use Git diff 2dot vs 3dot merge safety?
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.
What are the best alternatives to Git diff 2dot vs 3dot merge safety?
The closest alternatives to Git diff 2dot vs 3dot merge safety are Check a stale branch is not undoing newer main work, Git post merge cleanup, Gha PR merge ref shows upstream changes, Code review and Fix merge conflicts.
Where this comes from
- Description: from the skill's own SKILL.md.
More from wan-huiyan/agent-traffic-control

Teaches agents to refuse a flawed instruction only with measured evidence attached
- Open source
- 5 GitHub stars
- Developer tools

Catches silent deletions when a subagent edits large files with repeated blocks
- Open source
- 5 GitHub stars
- Developer tools

Holds a pull request from merging by stopping its agent, disarming auto-merge, then
- Open source
- 5 GitHub stars
- Developer tools

Checks that a batch of pull requests does not cite file paths that will never exist
- Open source
- 5 GitHub stars
- Developer tools

Checks whether a pull request truly landed by comparing file content, not commit subjects
- Open source
- 5 GitHub stars
- Developer tools

Checks a branch for stale-base changes that would silently undo newer main work
- Open source
- 5 GitHub stars
- Developer tools



