Workflows
Stacked Pull Requests Workflow
Split a large change into dependency-ordered PR layers to improve review throughput and reduce oversized review fatigue.
- Teams turning commands into repeatable routines
- Readers who need sequencing, branch, and sync discipline
- Basic understanding of fetch, pull, push, and branches
- A sense of how and why branches diverge
- Copying a workflow without checking branch state
- Choosing the wrong integration path on shared branches
A stacked PR workflow breaks one large initiative into smaller, dependency-ordered pull requests instead of one giant review unit.
Where this fits best
- a large feature can be sliced into ordered sub-problems
- review bandwidth is limited and giant PRs stall frequently
- you want foundational changes merged early to reduce conflict in top layers
How to split effectively
Prefer dependency-oriented layers, not arbitrary folder-based slicing:
- foundation layer (types, interfaces, utilities)
- behavior layer (core business logic)
- presentation layer (UI states, copy, final polish)
Minimal operating flow
git switch main
git switch -c stack/auth-base
# commit foundational changes
git switch -c stack/auth-service
# continue on top of auth-base
git switch -c stack/auth-ui
# continue on top of auth-service
Now open PRs for each layer and explicitly declare dependencies.
Keeping the stack healthy
When lower branches move, rebase upper layers promptly:
git switch stack/auth-service
git rebase stack/auth-base
git switch stack/auth-ui
git rebase stack/auth-service
Use git range-diff before merge to verify what changed between revisions:
git range-diff origin/main...stack/auth-service@{1} origin/main...stack/auth-service
Review collaboration guidelines
- Every PR description should state dependency order.
- Reviewers should start from the bottom layer.
- Upper-layer PRs should describe only incremental delta, not repeat base context.
If layer boundaries are blurry, stack complexity just spreads across multiple pages. Define each layer’s single responsibility before creating branches.
Common mistakes
Mistake 1: more layers always means better structure
Too many layers create maintenance overhead. Two to five layers are usually a practical range.
Mistake 2: upper layers can drift indefinitely
The longer upper layers wait to sync, the larger final conflict risk becomes.
Mistake 3: merge order is optional
Dependency order is mandatory; out-of-order merges create missing-base or duplicated-change states.
- Take a recent large PR and identify foundation, behavior, and UI layers.
- Write one sentence for each layer’s standalone value.
- Confirm each layer can pass CI independently.
- Use
range-diffto validate boundaries between revisions.
Good follow-up reads
Prepare commits before pull requestSmall batch reviewgit-range-diff