A lightweight CLI tool to create and manage stacked PRs on GitHub with zero config.
Stacked PRs (also called "PR chains" or "dependent PRs") let you break large features into small, reviewable chunks where each PR builds on the previous one. git-pr-stack automates the tedious parts.
- π Create stacked PRs β automatically chains PRs so each one targets the previous branch
- π View your stack β see the full chain of PRs at a glance
- π Rebase the whole stack β one command to rebase every branch in order
- β Merge & advance β merge the bottom PR and auto-retarget the next one
- π§Ή Clean up β remove merged branches from your stack
- π― Zero config β works with your existing Git + GitHub CLI setup
pip install git-pr-stackOr with Homebrew:
brew tap code-by-mahereddy/git-pr-stack
brew install git-pr-stack# Initialize a new stack
git pr-stack init
# Add branches to the stack
git pr-stack add feature/auth
git pr-stack add feature/auth-ui
git pr-stack add feature/auth-tests
# Create PRs for the entire stack
git pr-stack create
# View your stack
git pr-stack list
# Rebase the entire stack on main
git pr-stack rebase main
# Merge the bottom PR and advance the stack
git pr-stack mergemain ββββββββββββββββββββββββββββββββββββββ
β
βββ feature/auth β PR #1 (base: main)
β β
β βββ feature/auth-ui β PR #2 (base: feature/auth)
β β β
β β βββ feature/auth-tests β PR #3 (base: feature/auth-ui)
β β
β βββ feature/auth-api β PR #4 (base: feature/auth)
Each PR in the stack targets the previous branch instead of main. When the bottom PR is merged, git-pr-stack merge automatically retargets the next PR to main (or the new base).
| Command | Description |
|---|---|
init |
Initialize a new PR stack in the current repo |
add <branch> |
Add a branch to the top of the stack |
remove <branch> |
Remove a branch from the stack |
list |
Display the current stack with PR status |
create |
Create GitHub PRs for all branches in the stack |
rebase <onto> |
Rebase the entire stack onto a branch |
merge |
Merge the bottom PR and advance the stack |
sync |
Sync stack state with GitHub (detect merged PRs) |
status |
Check CI status for all PRs in the stack |
- Faster reviews β Small, focused PRs are reviewed 3x faster than large ones
- Parallel development β Work on multiple features that depend on each other
- Clean git history β Each PR is a logical unit of change
- Easier rollbacks β Revert one PR without affecting others
- Git 2.30+
- GitHub CLI (
gh) 2.0+ - Python 3.8+
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License β see LICENSE for details.
Made with β€οΈ by Mahereddy