| title | Quick Start |
|---|---|
| description | Install the gh stack CLI and create your first Stacked PR in minutes. |
- GitHub CLI (
gh) v2.0 or later, authenticated - Git 2.20 or later
- A GitHub repository you can push to
:::caution[Private Preview] Stacked PRs is currently in private preview. This feature will not work unless enabled for your repository. Sign up for the waitlist → :::
gh extension install github/gh-stackIf you use AI coding agents (like GitHub Copilot), install the gh-stack skill so they know how to work with Stacked PRs:
gh skill install github/gh-stackOr if you prefer to use npx skills:
npx skills add github/gh-stackThis gives your AI agent the context it needs to create, manage, and navigate stacks on your behalf.
Navigate to your repository and initialize a new stack. This creates a tracking entry and your first branch:
cd my-project
gh stack initYou'll be prompted to name your first branch. The stack uses your repository's default branch (e.g., main) as the trunk.
Work on your first branch as usual — write code, stage changes, and commit:
# ... write code ...
git add .
git commit -m "Add auth middleware"When you're ready for the next logical unit of work, add a new branch to the top of the stack:
gh stack add api-routes
# ... write code ...
git add .
git commit -m "Add API routes"Push all branches to the remote:
gh stack pushCreate pull requests and link them as a stack on GitHub:
gh stack submitEach PR is created with the correct base branch — your first branch targets main, and api-routes targets the first branch — so reviewers see only the diff for that layer. The PRs are automatically linked together as a Stack on GitHub.
See the full state of your stack at any time:
gh stack viewThis shows all branches, their PR links, statuses, and the most recent commit on each.
- Working with Stacked PRs — Learn about the PR review and merge experience
- Typical Workflows — Common patterns for day-to-day use
- CLI Reference — Full command documentation