From jack-software
Use when merging a stack of stacked PRs with jj. Triggered by phrases like "merge the PR stack", "merge the stacked PRs", "land these PRs", or "merge the stack into main".
npx claudepluginhub jack-michaud/faire --plugin jack-softwareThis skill uses the workspace's default tool permissions.
You are a staff engineer merging a stack of stacked jj branches into main via GitHub's merge queue.
Use Mergify stacks for git push, commit, branch, and PR creation. ALWAYS use this skill when pushing code, creating commits, creating branches, or creating PRs. Triggers on push, commit, branch, PR, pull request, stack, stacked, git, rebase, checkout, reorder, move, sync, amend, note, revision history.
Manages stacked branches and pull requests using gh-stack GitHub CLI extension for creating, pushing, rebasing, syncing, navigating, and viewing dependent PR stacks in incremental code review workflows.
Share bugs, ideas, or general feedback.
You are a staff engineer merging a stack of stacked jj branches into main via GitHub's merge queue.
List the PR stack from base to tip. If not provided, infer from jj log and gh pr list:
jj log --revisions 'ancestors(@, 10) & bookmarks()' --no-graph
gh pr list --state open
Order them base-first (the PR closest to main merges first).
Check CI on the base PR:
gh pr checks <base-pr-number>
Add the base PR to the merge queue (preferred) or merge directly:
gh pr merge <base-pr-number> --merge --auto
--auto will queue it automatically.Poll merge queue status via GraphQL until the entry is merged or errored:
gh api graphql -f query='
query($owner: String!, $repo: String!, $number: Int!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $number) {
mergeQueueEntry {
state
position
estimatedTimeToMerge
}
}
}
}
' -f owner=<owner> -f repo=<repo> -F number=<base-pr-number>
state values: QUEUED, AWAITING_CHECKS, MERGEABLE, MERGED, FAILED, LOCKEDstate is MERGED: proceed to Phase 3.state is FAILED or LOCKED: stop and report the failure. Do not proceed with the rest of the stack.state is QUEUED or AWAITING_CHECKS: wait ~30s and poll again. Repeat until terminal state.mergeQueueEntry (not using merge queue): check gh pr view <number> --json state — if state is MERGED, proceed.Fetch the updated remote:
jj git fetch
Rebase remaining stack branches onto main@origin:
jj rebase -s <next-branch-bookmark> -d main@origin
jj rebase -s <next-branch-bookmark> -d main@origin
jj will automatically carry descendants along.Resolve conflicts if any appear (jj log shows ! markers):
jj new <conflicted-rev-id> — create resolution on top<<</===/>>> markersjj squash — fold the resolution into the conflicted revisionjj log shows no ! markers.Verify base retargeting — the next PR's base should now target main:
gh pr view <next-pr-number> --json baseRefName
baseRefName is still the old merged branch: update it:
gh pr edit <next-pr-number> --base main
Push the rebased branches:
jj git push --bookmark <next-branch> --bookmark <branch-after-that> ...
Push all remaining stack branches in one command.
mainjj git fetch shows no pending stack branches diverging from main@originMERGED state! conflict markers remain in jj log