Skip to content
Stacked PRs is currently in private preview. Sign up for the waitlist →

Quick Start

  • GitHub CLI (gh) v2.0 or later, authenticated
  • Git 2.20 or later
  • A GitHub repository you can push to
Terminal window
gh extension install github/gh-stack

If you use AI coding agents (like GitHub Copilot), install the gh-stack skill so they know how to work with Stacked PRs:

Terminal window
npx skills add github/gh-stack

This 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:

Terminal window
cd my-project
gh stack init

You’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:

Terminal window
# ... 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:

Terminal window
gh stack add api-routes
# ... write code ...
git add .
git commit -m "Add API routes"

Push all branches to the remote:

Terminal window
gh stack push

Create pull requests and link them as a stack on GitHub:

Terminal window
gh stack submit

Each 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:

Terminal window
gh stack view

This shows all branches, their PR links, statuses, and the most recent commit on each.