| name | stacked-prs |
| description | Procedure for creating and managing stacked PRs when a task exceeds 200 diff lines. Use this when a task is too large for a single PR. |
When a task will produce more than 200 diff lines, split it into a stack of PRs. Each PR must be fully functional, standalone, and independently reviewable.
When to Stack
- Estimated diff > 200 lines after scoping.
- Task has natural layers (e.g., data model → API → UI).
- Multiple independent concerns in one task.
Procedure
1. Plan the Stack
Before writing code, define the stack:
Stack for feature/PROJ-123-user-auth:
PR 1: feature/PROJ-123-user-auth-model — User model and migrations
PR 2: feature/PROJ-123-user-auth-api — Auth API endpoints
PR 3: feature/PROJ-123-user-auth-ui — Login/signup UI
Each PR must:
- Be fully functional on its own (tests pass, no broken state).
- Provide standalone value (not just a partial step).
- Be ≤200 diff lines.
2. Create Branches
git checkout -b feature/PROJ-123-user-auth-model main
git checkout -b feature/PROJ-123-user-auth-api feature/PROJ-123-user-auth-model
git checkout -b feature/PROJ-123-user-auth-ui feature/PROJ-123-user-auth-api
3. Open PRs
4. Merge Order
Always bottom-up:
- Merge PR 1 into
main.
- Rebase PR 2 onto
main, then merge.
- Rebase PR 3 onto
main, then merge.
5. Handle Changes
If a reviewer requests changes to PR 1:
- Make changes on PR 1's branch.
- Rebase PR 2 onto updated PR 1.
- Rebase PR 3 onto updated PR 2.
- Force-push the rebased branches.