bip-pr-land
Land a PR branch — squash merge, clean up local and remote branches, return to main.
от matsen★ 35 звёзд на GitHub
Установить bip-pr-land в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
/bip-pr-land
Squash-merge the current branch's PR and clean up.
Usage
/bip-pr-land # Land the current branch's PR
/bip-pr-land #42 # Land PR #42 (if not on that branch)
Worktree mode
If bip spawn made the working tree as a linked worktree (layout: { mode: worktree } in ~/.config/bip/config.yml), Step 7a detects it and pulls from the primary clone, and Step 8 removes the worktree before deleting the branch. In clone mode the detection is a no-op.
Where to stand
This skill moves HEAD (Steps 7 and 8) and preserves the state files of its directory (Step 7a). Never run it in a clone another live session works in. To land a PR checked out in another session's clone, don't run this skill: run Step 6's guard from any checkout, against the PR head, so nothing moves:
git fetch -q origin "+pull/<N>/head:refs/pr/<N>" <base> \
&& sha=$(git rev-parse refs/pr/<N>) \
&& test "$sha" = "$(gh pr view <N> --json headRefOid -q .headRefOid)" \
&& git merge-base --is-ancestor origin/<base> "$sha" \
&& gh pr merge <N> --squash --match-head-commit "$sha" --body "closes #<issue>"
If the ancestor test fails, by default rebase refs/pr/<N> onto origin/<base> in a scratch worktree, git push --force-with-lease origin HEAD:<headRefName>, run the repo's gate on the rebased head (CI per Step 5.5; with no CI, the local gate its CLAUDE.md names), and re-run the guard. You may land behind (merge a stale head without the rebase, running the guard without its ancestor line) only when the PR is truly disjoint from what landed since: the missed commits cannot affect it. Sharing no file is not enough; a missed change to code the PR imports, calls or reads disqualifies it. CI must still be green at the head (Step 5.5). Say why it is disjoint in a PR comment.
Do this only for a worker that has ended (stop_reason: awaiting-human-merge, session idle). A live worker holding a landing delegation lands its own PR. If the clone is a fleet slot, reclaim it through /bip-conductor, which runs the issue-lead's terminal ceremony before preserving (Step 7a here would delete the status file the ceremony keys on).
Check for co-tenancy:
for p in $(pgrep -x claude); do readlink /proc/$p/cwd; done | /usr/bin/grep -cE "^$PWD(/|$)"
More than 1 means co-tenancy. The count is a floor: it misses a session that cds into this clone inside its Bash calls. To inspect a PR read-only, prefer git show <sha>:<path> with gh pr view <N> --json headRefOid; git fetch origin pull/N/head:<branch> silently leaves an existing local branch at its old SHA (use -f).
Workflow
Step 1: Check for uncommitted work
git status --porcelain
git diff --stat
Resolve every dirty or untracked file; never git stash. Read enough of each to know what it is, then:
- Belongs to this PR: commit it.
- Unrelated: move it to
_ignore/$(date -I)-landing/(mkdir -p first) and tell the user. - Unclear: show the user the diff and ask.
Step 2: Identify the PR
# Get current branch
BRANCH=$(git branch --show-current)
# Find the PR for this branch
gh pr view "$BRANCH" --json number,title,state,baseRefName
Abort if there is no PR or it is not open. Save baseRefName as <base>.
Step 3: Log and proceed
Print the summary line and continue without waiting for confirmation:
Landing: #42 "Add feature X" (branch: my-feature → main)
Step 4: Update base branch and rebase
git fetch origin
git rebase origin/<base>
On conflicts, stop and report. Do not force-push or auto-resolve.
Step 5: Force-push rebased branch
git push --force-with-lease
Step 5.5: Wait for CI to pass
gh pr checks "$BRANCH" --json name,state,conclusion
- Empty array and no
.github/workflows/: proceed. Empty array in a repo with workflows means CI hasn't registered yet: wait (until [ "$(gh pr checks "$BRANCH" --json name | jq length)" -gt 0 ]; do sleep 30; done), then continue below. - Checks present: block with
gh pr checks "$BRANCH" --watch -i 60 --fail-fastuntil all required checks concludeSUCCESS,NEUTRALorSKIPPED.SKIPPEDpasses only if a check that builds or tests concludedSUCCESSat this head: a gate job can succeed while skipping the tests it gates. If so, rebase and wait for the tests. - Any check fails: do not merge. Report the failing check (
gh pr view --web) and stop.
Step 6: Squash merge via gh
Ask GitHub which issues the PR will close:
gh pr view <N> --json closingIssuesReferences --jq '.closingIssuesReferences[].number'
Empty is a defect if the PR has an issue. A number the PR should not close is a defect too: prose such as "That PR closes #N" adds it, and the merge closes it. Reword the body until the list holds only the PR's issues. The field is eventually consistent, so re-read before concluding a body edit did not take.
Keep the guard inside the merge command so the base cannot
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл bip-pr-land?
Land a PR branch — squash merge, clean up local and remote branches, return to main.
Как установить скилл bip-pr-land?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл bip-pr-land запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…