Quick Start
Commands
wit stack create
Start a new stack from the current branch.
| Option | Description |
|---|---|
-d <desc> | Optional description for the stack |
wit stack push
Create a new branch on top of the stack.
auth-feature/part-1, auth-feature/part-2).
Examples:
wit stack pop
Remove the top branch from the stack (keeps the branch itself).
wit stack list
Show all stacks in the repository.
* indicates the current active stack.
wit stack show
Show a visualization of the current stack or a specific stack.
wit stack sync
Rebase the entire stack when the base branch changes.
- Fetches the latest base branch
- Rebases each branch in order from bottom to top
- Reports any conflicts that need resolution
wit stack submit
Push all stack branches to the remote for review.
| Option | Description |
|---|---|
--force, -f | Force push all branches |
wit stack delete
Delete a stack (keeps the branches).
Navigation
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.
Advanced Operations
wit stack reorder
Reorder branches in the stack.
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:- Data models / types first
- Backend logic second
- Frontend / UI last
Sync Frequently
Runwit 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 duringwit stack sync:
- Resolve conflicts in the current branch
- Run
wit rebase --continue - Run
wit stack syncto continue syncing remaining branches