plugins/ls-git/skills/stacked-pull-requests/SKILL.md
Use when working with a stack of GitHub pull requests — creating branches, keeping the stack in sync, or merging in order. Covers Git Town setup, PR targeting, rebasing, and landing the stack.
npx skillsauth add LandonSchropp/agent-toolkit stacked-pull-requestsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Uses Git Town to manage parent/child branch relationships. REQUIRED: Run git town help for the full command list, or git town <command> --help for documentation on a specific command.
git town hack <branch-name>.git town append <next-branch-name>. (append always creates off the current branch; hack always creates off main.)scripts/list-pull-request-tree.rb --branch <any-branch> and confirm all PRs appear in the expected order.When upstream changes or a parent branch is updated, run git town sync --stack to sync every branch in the stack. If conflicts arise:
git town continue.Merge oldest ancestor first. REQUIRED: Confirm the full merge order with the user before merging anything.
Discover the tree: Run scripts/list-pull-request-tree.rb --branch <name>. Pass any branch in the tree — the script walks up to the oldest ancestor and down through all descendants.
For each PR in order:
a. Retarget the next PR (if one exists): Run scripts/retarget-pull-request-to-default-branch.sh --pull-request-url <next-url>. When merging via the CLI, GitHub does not auto-retarget dependent PRs — it closes them instead (cli/cli#1168). Retargeting manually before each merge prevents this.
b. Merge the current PR: REQUIRED: Use the ls:merge-pull-request skill.
c. Sync the remaining stack: Run git town sync --stack from any remaining branch. Git Town will detect the merged branch is gone and rebase the next branch onto main.
On repos that squash-merge, verify the child branch has no duplicate commits from the just-merged branch. If duplicates are present, strip them with git rebase --onto main <last-commit-of-merged-branch> <child-branch>, then push with --force-with-lease.
| Thought | Reality |
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| "I'll use git town hack for child branches" | hack creates branches off main. Use git town append from the parent branch instead. |
| "I'll create PRs targeting main" | PRs must target their parent branch so reviewers see only that branch's changes. |
| "I'll skip retargeting — GitHub handles it" | GitHub does not auto-retarget when merging via CLI — it closes the next PR instead (cli/cli#1168). Always retarget. |
| "I'll skip syncing after a merge" | The next PR's branch will be stale. Always sync after each merge. |
| "I'll merge all at once" | Each PR must land on the default branch before the next is rebased onto it. |
tools
Use when a finished, reviewed branch is committed and needs to be merged into the default branch in a repo that integrates directly to `main` (not via pull request).
tools
Use when writing or modifying tests in a Bun project
tools
Use when publishing or releasing a new version of an npm/pnpm/yarn/bun package to the registry. Covers package-manager detection, semver bump selection, tagging, pushing, scoped-package access, authentication, and one-time passwords (OTP).
tools
Use when a finished worktree's branch has been reviewed and committed and needs to land. Rebases onto the latest default branch, then either fast-forwards it into the default branch (personal direct-to-main repos) or pushes it for a pull request (shared feature-branch repos).