Skip to main content
Your PR is 2,000 lines. Your reviewer’s eyes glaze over. “LGTM” with no real review. Stacked diffs fix this. Break one big feature into a stack of small, reviewable PRs:
Each PR is small enough to actually review. wit manages the dependencies so you don’t have to.

Quick Start


Commands

wit stack create

Start a new stack from the current branch.
Examples:
After creating a stack, you’ll see:

wit stack push

Create a new branch on top of the stack.
If no branch name is provided, wit automatically generates one based on the stack name (e.g., auth-feature/part-1, auth-feature/part-2). Examples:

wit stack pop

Remove the top branch from the stack (keeps the branch itself).
This removes the branch from stack tracking but doesn’t delete the Git branch.

wit stack list

Show all stacks in the repository.
Output:
The * indicates the current active stack.

wit stack show

Show a visualization of the current stack or a specific stack.
Output:

wit stack sync

Rebase the entire stack when the base branch changes.
This command:
  1. Fetches the latest base branch
  2. Rebases each branch in order from bottom to top
  3. Reports any conflicts that need resolution
Handling Conflicts:

wit stack submit

Push all stack branches to the remote for review.
This prepares all branches for review by ensuring they’re pushed to the remote.

wit stack delete

Delete a stack (keeps the branches).
Example:
Output:

wit stack up

Move to the child branch (one level up in the stack).

wit stack down

Move to the parent branch (one level down in the stack).

wit stack goto

Jump to a specific branch in the stack by name or index.
Examples:

Advanced Operations

wit stack reorder

Reorder branches in the stack.
Example:
After reordering, run wit stack sync to rebase branches to the new order.

Workflow Example

Here’s a complete workflow for implementing a user authentication feature:

Best Practices

Keep Branches Small

Each branch in a stack should represent a single logical change. Aim for:
  • 200-400 lines of code changes
  • One clear purpose per branch
  • Easy to review in isolation

Order by Dependency

Structure your stack so each branch builds on the previous:
  1. Data models / types first
  2. Backend logic second
  3. Frontend / UI last

Sync Frequently

Run wit stack sync after:
  • Pulling updates to base branch
  • Making changes to lower branches
  • Before submitting for review

Communicate Stack Structure

When creating PRs, mention that they’re part of a stack:

Troubleshooting

Conflict During Sync

If you encounter conflicts during wit stack sync:
  1. Resolve conflicts in the current branch
  2. Run wit rebase --continue
  3. Run wit stack sync to continue syncing remaining branches

Branch Not in Stack

If you get “Not currently on a stacked branch”:

Recovering from Failed Sync

If sync fails partway through: