Vibeleaderboard
Index / tool
Visit github.com
Category
Developer Tools
Rank
No. 1007Tools index
Pricing
Open Source
Type
TOOL
Use case
Coding
Interfaces
CLI · Agent Skill / Plugin
Builder
@github
Latest release
v0.3.0
Date

About

A GitHub CLI extension for managing stacked branches and pull requests, where a large change is split into a chain of small PRs that build on each other. It automates creating branches, keeping them rebased, setting the correct PR base branches, and navigating between layers, with commands such as `gh stack init` and `gh stack add`. A companion skill can be installed so AI coding agents know how to drive the CLI.

What it does

Stacked pull requests split one big change into a chain of small ones, each built on the branch below it, so reviewers read one layer at a time. This command line add-on for GitHub's official CLI keeps that chain honest: it records which branches belong together, opens one pull request per layer with the right base, rebases every layer when something underneath moves, and pushes the lot. It then links the pull requests into a single stack object on GitHub, so the relationship is visible on the site rather than only in branch names.

Why it's ranked here

It is published under GitHub's own organization and built on the same Go libraries as the official CLI, so it talks to the platform's native stack feature rather than imitating one with comments. The engineering shows care where stacking tools usually break: rebases write a recovery journal and can be continued or aborted, sync restores every branch if any rebase conflicts, pushes go out atomically with a lease check, and most commands ship with a paired test file. For teams already on GitHub, it is the reference implementation of the workflow.

What's good

Failure handling is concrete. A conflicted sync puts every branch back where it was and tells you to run an interactive rebase instead. Pushes after a rebase use a lease check, so a teammate's newer commits are not silently overwritten. Git's conflict memory is switched on so a resolution made once is replayed on later rebases. The submit step opens a full-screen editor to draft every pull request title and description at once, and a scripted mode creates drafts instead. Merged and queued layers are skipped automatically. An installable agent skill teaches coding agents the same commands.

Tradeoffs

It is GitHub only. The linked stack view needs the repository to have stacked pull requests enabled; otherwise submit offers to fall back to ordinary, unlinked pull requests. Its locks coordinate its own processes only, so another Git tool or editor rewriting history mid-rebase is on you. The modify command refuses to mix reordering with drops, folds, inserts or renames in one session. It turns on Git's conflict memory in your repository without asking, and it checks for new versions in the background unless an environment variable disables it. The documentation also warns against mixing old and new versions within one clone.

How to use it well

Use it if your team reviews on GitHub and you regularly ship changes too large for one comfortable review. Start a stack, add a branch per logical layer, and let submit open the pull requests; run sync whenever the main branch moves. Turn off the update check in CI with the documented environment variable. Keep worktrees idle while a rebase runs, and finish or abort a paused operation before upgrading. It does not help on GitLab or other hosts, and it is not a general Git history editor beyond the stack.

Technical notes+

main.go hands off to cmd/root.go, a Cobra tree that groups commands into stack management, remote operations, navigation and utilities, and starts a non-blocking update check that finish() never waits on. Every mutating command calls beginStackMutation first; internal/stack/lock.go implements it as an exclusive advisory operation lock beside a separate catalog lock, both retried every 100ms up to a 5 second LockTimeout, with lock files deliberately left on disk to avoid an unlinked-inode race. internal/stack/stack.go stores the catalog as JSON in Git's common directory, records a SHA-256 of the bytes at Load and rejects a Save whose on-disk checksum changed (StaleError), and refuses files with a newer schemaVersion. cmd/submit.go checks ListStacks to detect whether the repository supports stacks, runs a Bubble Tea editor for drafts, then pushes and calls ensurePR bottom to top. cmd/sync.go runs fetch, remote reconcile, trunk fast-forward, cascadeRebase, and an atomic force-with-lease push, rolling back via rollbackWorktreeRebase on conflict. cmd/rebase.go persists a rebaseState journal before cascading. internal/github/github.go mixes GraphQL mutations with a REST PATCH for base changes and accepts a GHES host. internal/modify/plan.go compiles modify actions and rejects reorder plus structural edits together. go.mod pins github.com/cli/cli/v2 v2.93.0 and go 1.26.0.

Observed

Language
Go, module declares go 1.26.0
Interface
CLI installed as a GitHub CLI extension: gh extension install github/gh-stack
Requirements
GitHub CLI v2.0+ and Git 2.36+
Agent integration
Installable skill: gh skill install github/gh-stack
Local state
JSON catalog in Git's common directory, shared across linked worktrees, not committed
Hosts
github.com and GitHub Enterprise Server hostnames
Concurrency control
Operation and catalog file locks with a 5 second timeout, plus checksum-based stale-write detection
Push safety
sync pushes all branches with --force-with-lease --atomic
Update check
Background check cached for 24 hours, disabled by GH_STACK_NO_UPDATE_NOTIFIER
Tests
Go test files alongside most command and internal package sources in the repository tree

Read from README.md, go.mod, main.go, cmd/root.go, cmd/submit.go, cmd/rebase.go, cmd/sync.go, internal/stack/stack.go, internal/stack/lock.go, internal/github/github.go, internal/modify/plan.go.

Tags

gitgithubclipull-requestsstacked-prscode-review

Tech Stack

Go

Comments (0)

No comments yet

Editorially curated, with community endorsements as a secondary signal. Corrections welcome.