Skip to content

Latest commit

 

History

History
113 lines (83 loc) · 3.52 KB

File metadata and controls

113 lines (83 loc) · 3.52 KB

🥞 git-pr-stack

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.

✨ Features

  • 🚀 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

📦 Installation

pip install git-pr-stack

Or with Homebrew:

brew tap code-by-mahereddy/git-pr-stack
brew install git-pr-stack

🚀 Quick Start

# 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 merge

📖 How It Works

main ──────────────────────────────────────
  │
  ├── 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).

🛠️ Commands

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

💡 Why Stacked PRs?

  • 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

🔧 Requirements

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

MIT License — see LICENSE for details.


Made with ❤️ by Mahereddy