Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

worktree-stale-base-merge

БесплатноБез исполняемых скриптовНе проверен

Merging a PR from a parallel worktree-agent branch, or any branch cut from an older main. Use when deciding whether a green CI check still means anything…

laurigatesот laurigates★ 61 звезда на GitHub

Об этом скилле

Rebase a Parallel Worktree-Agent Branch Before Merging — Its Green CI Is About a main That No Longer Exists

When you dispatch several isolation: "worktree" agents that each branch off origin/main and open a PR, the ones that finish later were cut from a main that no longer exists. Their CI ran against that older tree, so a green check is a claim about a base the merge will not use. Nothing on the PR page says so: the checks are green, the diff looks like a clean feature addition, and the sibling work that landed in the meantime is invisible.

The merge itself is safe — see "What this rule used to say, and why it was wrong" in REFERENCE.md. The exposure is verification: the branch was never built or tested against the tree it is about to become part of. A sibling that renamed a function, changed a signature, tightened a lint, or added a conflicting migration produces a main that is red the moment both land, and the failure surfaces on someone else's PR.

This is the merge-time companion to agent-worktree-resume-for-pr-feedback.md (resume vs. fresh worktree for PR feedback) and shared-checkout-branch-isolation.md (commit-time HEAD contamination). Here the hazard is purely about the base a parallel branch was cut from.

When to Use This Skill

Use this skill when... Use something else when...
A PR's branch was cut before sibling PRs merged Asking whether the branch's work already landed → git-merge-hazards (next section)
Deciding between gh pr update-branch and a rebase Rebasing a stack registered with gh stack → git-stacked-prs
Re-verifying a worktree agent's branch before merge Addressing review feedback on that agent's PR — resume the agent instead of a fresh worktree

First, don't confuse this with containment

"Is this branch's base still current?" (this skill) and "has this branch's work already landed?" are different questions with different tools, and the second has its own authority order — a MERGED PR is authoritative, git cherry next:

gh pr list --state all --head <branch> --json state,mergedAt   # MERGED = authoritative
git cherry main <branch>                                       # '-' = patch already upstream

git merge-tree is a positive-containment shortcut for that second question, never its primary signal: a match proves the work landed, a non-match proves nothing once the base has drifted over the same files. Everything below uses merge-tree for the other direction — what tree the merge will produce — where it is authoritative both ways. git-plugin:git-merge-hazards owns the containment ladder in full.

The 5-second check — merge-base equality

Ask whether the branch's base is still main's tip. That is the question a diff cannot answer:

git fetch origin
test "$(git merge-base origin/main <branch>)" = "$(git rev-parse origin/main)" && echo "base current" || echo "STALE BASE — green CI proves nothing about post-merge main"

base current ⇒ CI ran against what the merge will produce. A stale base is not by itself a reason to block — see Prevention for when it is cheap to leave.

The cheap fix first — gh pr update-branch (no force-push)

When the branch is not history-sensitive — no stacked child depending on its SHAs, no requirement for linear history — prefer merging main into the PR branch over rebasing it:

gh pr update-branch <n> -R <owner>/<repo>
git fetch origin
test "$(git merge-base origin/main <branch>)" = "$(git rev-parse origin/main)" && echo "base current" || echo "STILL STALE"

This resolves the stale base with no force-push, so it sidesteps the whole hazard family the rebase path carries: no HEAD:-refspec SHA race (git-plugin:git-merge-hazards, stacked-chain push-by-SHA), no empty-diff auto-close, no force-with-lease confirmation, and nothing destructive to recover from if it goes wrong. The cost is the merge method: a branch with a merge commit squash-merges (rule 4 in github-pr-title → merge-strategies.md), and the squash collapses the extra merge commit, so the landed content matches the rebased version. A branch whose commits should land individually (rebase-merge) needs the rebase in § The fix instead.

gh pr update-branch lies in both directions — never trust its message. Observed 2026-07: it printed "Cannot update PR branch due to conflicts" twice while actually succeeding, and once failed genuinely with a similar message. The message is not the signal; re-run the merge-base check above and believe that. Then let CI re-run and go green on the new base — that re-run is the entire point of the exercise.

Reach for the rebase below when update-branch is wrong: the PR should rebase-merge, a stacked child needs the parent's SHAs to stay rebase-able, the repo requires linear history, or the branch is pinned to an age

Полный SKILL.md на GitHub

Установить worktree-stale-base-merge в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash(gh pr list *)
Bash(git cherry *)
Bash(git merge-tree *)
Bash(git fetch *)
Bash(git merge-base *)
Bash(git rev-parse *)
Bash(gh pr update-branch *)
Bash(git log *)
Read
Grep
Glob
TodoWrite

Вложенные файлы

REFERENCE.md

FAQ

Что делает скилл worktree-stale-base-merge?

Merging a PR from a parallel worktree-agent branch, or any branch cut from an older main. Use when deciding whether a green CI check still means anything after sibling branches have landed.

Как установить скилл worktree-stale-base-merge?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл worktree-stale-base-merge запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить worktree-stale-base-merge с