A CLI tool for efficiently managing Git worktrees. Supports parallel work across multiple branches and manages the entire lifecycle of worktrees.
go install github.com/knwoop/giwo@latestCreate a new worktree based on the default branch.
giwo create feature-auth
giwo create bugfix-login --base develop
giwo create experiment-ui --forceOptions:
--base <branch>- Base branch to create worktree from (default: repository default branch)--force- Force creation even if directory exists
Features:
- Places worktree in
.worktree/<branch-name> - Automatically creates and switches to new branch
- Copies config files (.env, .gitignore, .editorconfig, etc.)
- Fetches default branch via GitHub API (requires GITHUB_TOKEN)
Remove a worktree and optionally its local branch.
giwo remove feature-auth
giwo remove bugfix-login --keep-branch
giwo remove old-feature --forceAliases: rm, delete
Options:
--force- Force removal without confirmation--keep-branch- Keep the local branch after removing worktree
Display all worktrees with status information.
giwo list
giwo list --verbose
giwo list --format jsonAliases: ls
Options:
--verbose- Show detailed information (commits, changes, etc.)--format <table|json|simple>- Output format
Show worktree statistics and recommendations.
giwo statusOutput:
- Total worktrees count
- Active vs dirty worktrees
- Merged branches that can be cleaned
- Recommended actions
Batch remove worktrees for merged branches.
giwo clean
giwo clean --dry-run
giwo clean --forceOptions:
--dry-run- Show what would be removed without actually removing--force- Force removal without confirmation
Features:
- Automatically detects merged branches
- Excludes main/master/develop branches
- Shows branch status before removal
Switch to a worktree interactively with fuzzy search support.
giwo switch
giwo switch feature
giwo switch --fuzzy
giwo switch --filter auth
giwo switch --printAliases: sw
Options:
--fuzzy- Use interactive fuzzy search (like fzf)--filter <text>- Filter worktrees by branch name--print- Print the selected worktree path instead of switching
Features:
- Interactive selection with numbered options
- Fuzzy search with real-time filtering
- Visual status indicators (clean/dirty, ahead/behind)
- Shell integration support
Remove administrative files for orphaned worktrees.
giwo pruneWrapper around git worktree prune -v.
Set GITHUB_TOKEN environment variable to enable:
- Automatic default branch detection
- Better API rate limits
export GITHUB_TOKEN=your_token_hereproject-root/
├── .worktree/
│ ├── feature-auth/ # feature-auth branch
│ ├── bugfix-login/ # bugfix-login branch
│ └── experiment-ui/ # experiment-ui branch
└── main-worktree/ # Main worktree
For seamless directory switching, source the provided shell script:
# Add to your .bashrc or .zshrc
source /path/to/giwo/scripts/giwo-switch.sh
# Now you can use:
gws # Interactive switch
gwf # Fuzzy search
giwo-switch --filter ui # Filter and switch# Create a new feature branch worktree
giwo create feature-auth
# Switch to a worktree interactively
giwo switch
# Use fuzzy search to find and switch
giwo switch --fuzzy
# Filter worktrees and switch
giwo switch auth
# List all worktrees
giwo list --verbose
# Check status and get recommendations
giwo status
# Clean up merged branches
giwo clean --dry-run
giwo clean
# Remove specific worktree
giwo remove feature-auth