git-merge-hazards
БесплатноЗапускает вложенные скриптыНе проверенTraps in GitHub's merge machinery. Use when merging a PR, merging a stacked or serial PR chain, auditing whether a branch really landed, or merging over red CI.
от laurigates★ 61 звезда на GitHubОб этом скилле
Git Merge Hazards
When to Use This Skill
| Use this skill when... | Use something else when... |
|---|---|
| Merging a PR, or proving a branch landed | The PR's green CI ran against an older main → git-plugin:worktree-stale-base-merge |
| Deciding whether a red PR can merge (§4) | Deciding whether a red AI-review check is a real finding → github-actions-plugin:ai-review-max-turns |
| Merging an ad-hoc stacked chain (§2, §3) | Release-please PRs are piling up or conflicting → git-plugin:release-please-pr-workflow |
The numbered sections mirror the ~/.claude/rules/pr-merge-hazards.md rule;
differences: references/sync-notes.md.
Six traps in GitHub's merge machinery, one law: "PR merged" says nothing about
content — and a red check is not proof of failure. Sibling: git-plugin:git-local-hazards (local git).
1. --merged misses squash-merged branches
A squash-merge collapses a branch into one fresh-SHA commit on main, so the
branch's own commits are never ancestors — git branch --merged (and any
ancestry check) reports it unmerged. "Files identical to main" also fails
once main drifts the same files.
- Check, in order of authority:
gh pr list --state all --head <branch> --json state→ a MERGED PR is authoritative. Reach for this first; the git-side checks below are all one-way.git cherry main <branch>→ marks a commit-when a patch-equivalent commit is already upstream,+when it is not. Survives squash and cherry-pick, and does not care thatmaindrifted.git merge-tree --write-tree main <branch>equalsgit rev-parse main^{tree}→ contained. A match proves containment; a non-match proves nothing.
- Not immune to drift (corrected 2026-07): once
mainmoves on over the same files, merging an already-merged branch back would re-introduce its older versions, so the trees differ and merge-tree reports not contained for work that fully landed. Observed reporting three merged branches as unmerged. Same trap as "files identical to main". Use the PR state orgit cherryto decide; keep merge-tree only as a positive-containment shortcut. - Fix:
just -g branch-audit(inprivate_dot_config/just/git.just) prints MERGED vs REVIEW + a paste-ready delete. Its REVIEW bucket measured ~90% false positives (#2268), so a REVIEW line is a question to settle withgh pr list --state all --head <branch>, not a verdict. - A non-match is "review", not proof of unmerged — don't force the count to zero.
2. Merging a stacked base auto-CLOSES the child PR
When PR B is based on PR A's branch, merging A and deleting its branch auto-closes B (GitHub does not retarget it), and a closed PR whose base branch is gone cannot be reopened.
- Check the base first (skill-only):
gh pr view <base> --json state,mergeStateStatus,mergeablebefore retargeting. Proceed only whenstateisOPENandmergeableisMERGEABLE; themergeStateStatusvalues and theUNKNOWNwait are in references/no-force-push-stack.md. - Fix — order matters: retarget the child first, while the base PR is open:
gh pr edit <child> --base maingh pr merge <base> --<method> --delete-branch(method:pr-merge-method.py)git rebase --onto origin/main <old-base-tip> <child-branch>(drops the base's commits) +git push --force-with-lease- merge the child.
- No-force alternative (skill-only, preferred when the child builds only on its base): merge
maininto the child with no force-push, after a classification that decides whether-X oursis lossless. Recipe: references/no-force-push-stack.md. The rebase path in the Fix steps is the fallback. - Delta-apply (skill-only) when the child forked from an older base head, or an independent PR shares its files: references/delta-apply-stack.md.
- Fork PR on an open upstream PR's head (skill-only): merging pushes into that PR too: references/fork-upstream-base.md.
- If already auto-closed: the head branch survives — rebase as above,
gh pr createfresh, comment "Superseded by #new" on the closed one. - Nothing tells you this happened, and only a scheduled sweep finds it; a dead base ref tells an auto-close from a human close: references/stranded-child-audit.md.
3. Stacked-chain merges: push by SHA, never HEAD: — and expect auto-close races
Read references/stacked-chain-push.md before any force-push or merge in a stacked-PR chain. It carries the push-by-SHA refspec form, the empty-diff auto-close, the mergeability and CI-registration races, the pre-push check, and auto-close recovery.
4. A red PR may still be mergeable — UNSTABLE is not `BLOC
Установить git-merge-hazards в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobBash(gh pr *)Bash(gh issue *)Bash(gh api *)Bash(git cherry *)Bash(git merge-tree *)Bash(git rev-parse *)Bash(git rev-list *)Bash(git log *)Bash(git reflog *)Bash(git rebase *)Bash(git merge *)Bash(git checkout *)Bash(git worktree *)Bash(git diff *)Bash(git add *)Bash(git commit *)Bash(git -C *)Bash(git merge-base *)Bash(grep *)Bash(awk *)Bash(jq *)Bash(git push *)Bash(git fetch *)Bash(git cat-file *)Bash(sleep *)Bash(just *)Bash(bash *)TodoWriteВложенные файлы
FAQ
Что делает скилл git-merge-hazards?
Traps in GitHub's merge machinery. Use when merging a PR, merging a stacked or serial PR chain, auditing whether a branch really landed, or merging over red CI.
Как установить скилл git-merge-hazards?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл git-merge-hazards запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
ci-review
The scan that the plugin's GitHub Action runs.
от Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
от GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
от GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
от GitHub