Skip to content

code-by-mahereddy/git-pr-stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯ž 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

About

πŸ₯ž A lightweight CLI tool to create and manage stacked PRs on GitHub with zero config

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages