Overview
Worktrees enable true parallel development by allowing you to work on multiple branches simultaneously without constant context switching. Each worktree is an independent working directory with its own branch checked out.Why Use Multiple Worktrees?
Traditional Git Problems
With standard Git, switching branches disrupts your workflow:The Worktree Solution
With worktrees, each branch has its own directory:Working on Multiple Features Simultaneously
Create Feature Worktrees
Navigate Between Features
Parallel Development Workflow
Using Worktrees for Different Contexts
Organize worktrees by type and purpose:Feature Development
feature-<description>
Bug Fixes
bugfix-<description> or hotfix-<description>
Experiments and Prototypes
experiment-<description> or spike-<description>
Documentation
docs-<description>
Release Preparation
release-<version>
Organizing Worktrees by Type
Directory Structure Example
List by Type
Navigate by Pattern
Managing Many Worktrees Effectively
Keep Track of Active Work
List worktrees with their status:Sync All Worktrees
Update all worktrees with latest changes:Monitor Resource Usage
Worktrees share the same Git objects, saving space:Set Limits
Avoid creating too many worktrees:- Recommended: 5-10 active worktrees
- Maximum: 20-30 worktrees
- Beyond this, tracking becomes difficult
When to Clean Up with repo wt clean
The repo wt clean command removes all non-main worktrees.
When to Use Clean
End of sprint:What Clean Does
From functions/worktree.zsh:178-209,repo wt clean:
- Lists all worktrees
- Identifies the default branch (main/master)
- Attempts to remove all other worktrees
- Skips worktrees with uncommitted changes
- Prunes stale worktree references
- Shows remaining worktrees