| name | managing-stacked-prs |
| description | Manages stacked pull requests using git-spice. Creates smaller, reviewable PRs that build on each other, submits them for review, handles feedback, and maintains clean stack history. Use when working with git-spice, stacked PRs, or managing dependent branches. |
Managing Stacked PRs with git-spice
This skill helps you work with git-spice for managing stacked pull requests - breaking large features into smaller, reviewable chunks that build on each other.
Core Concepts
Stacking means creating branches that build on top of each other:
main → feature/database → feature/api → feature/ui
Each branch:
- Builds on the one below it
- Can be reviewed and merged independently
- Stays in sync through restacking
Essential Commands
Creating Stacks
gs bc <branch-name>
gs log short
Submitting PRs
gs ss
gs uss
gs dss
gs bs
Keeping in Sync
gs rs
gs sr
gs upstack restack
Quick Workflows
Starting a New Stack
- Sync with trunk:
gs rs
- Create first branch:
gs bc feature/part-1
- Make changes, commit normally with git
- Stack next branch:
gs bc feature/part-2
- Repeat for each layer
- View structure:
gs log short
- Submit all:
gs ss
Handling Review Feedback
- Checkout the branch:
git checkout <branch-name>
- Make changes, commit
- Restack branches above:
gs upstack restack
- Push changes:
git push --force-with-lease
- Update upstack PRs:
gs upstack submit
After Merges
- Sync:
gs rs (updates trunk, removes merged branches)
- Restack remaining:
gs sr
- Update PRs:
gs ss
Key Principles
✅ Always use git-spice for rebasing - Never use git rebase directly on stacked branches
✅ Sync regularly - Run gs rs to stay up-to-date with trunk
✅ Restack after changes - Any change to a lower branch needs gs upstack restack
✅ Commit with git, manage stack with git-spice - Use normal git for commits, git-spice for stack operations
✅ Test each layer - Each branch should work independently
Common Patterns
Check current state
gs log short
git status
gh pr list --author @me
Submit for review with GitHub CLI
gs ss
gh pr view <pr-number>
gh pr edit <pr-number> --add-label "stack"
Handle conflicts during restack
git add <resolved-files>
git rebase --continue
Detailed Workflows
For step-by-step guides:
For complete command reference → See reference/commands.md
Integration with GitHub
git-spice works with GitHub CLI (gh):
- PRs include navigation comments showing stack relationships
- Use
gh pr commands alongside git-spice
- Edit PR titles/descriptions with
gh pr edit
Tips
💡 Use shorthands: gs bc, gs ss, gs sr instead of full commands
💡 Run gs log short frequently to verify stack structure
💡 Keep branches small and focused - easier to review and manage
💡 Merge PRs bottom-up - lower branches first, then dependencies
💡 Use --force-with-lease when force pushing - safer than --force