A CLI for managing git worktrees with lifecycle hooks. Create isolated, fully testable environments for running multiple LLM coding agents in parallel.
wt.demo.mov
brew install agarcher/tap/wtAfter installing, add shell integration to your shell config:
# zsh (~/.zshrc)
eval "$(wt init zsh)"
# bash (~/.bashrc)
eval "$(wt init bash)"
# fish (~/.config/fish/config.fish)
wt init fish | sourceRestart your shell or source the config file.
From Source
git clone https://github.com/agarcher/wt.git
cd wt
make build
make install # Installs to /usr/local/binThen add shell integration as shown above.
Download Binary
Download the latest release from the releases page and add it to your PATH.
Then add shell integration as shown above.
Requirements: Git 2.5+ (2.13+ recommended for optimal completion)
- Create a
.wt.yamlfile in your repository root:
version: 1
worktree_dir: worktrees- Create and use worktrees:
wt create feature-x # Create and cd into worktrees/feature-x
wt list # List all worktrees
wt cd feature-x # Switch to a worktree
wt exit # Return to main repo
wt delete feature-x # Delete worktree and branch| Command | Description | Details |
|---|---|---|
wt create <name> |
Create a new worktree | docs |
wt delete [name] |
Delete a worktree and its branch | docs |
wt list |
List all worktrees with status | docs |
wt info [name] |
Show detailed worktree information | docs |
wt cd <name> |
Change to a worktree directory | docs |
wt exit |
Return to main repository | docs |
wt cleanup |
Remove worktrees with merged branches | docs |
wt config |
Manage user configuration | docs |
wt init <shell> |
Generate shell integration | docs |
wt root |
Print main repository path | docs |
wt version |
Print version | docs |
See the Usage Guide for detailed command documentation.
Each repository is configured via .wt.yaml at the repository root:
version: 1
worktree_dir: worktrees # Where worktrees are stored
branch_pattern: "{name}" # Branch naming pattern
default_branch: main # Branch for comparison
hooks:
post_create:
- script: ./scripts/setup.shSee Repository Configuration for all options.
Global settings are stored in ~/.config/wt/config.yaml:
wt config --global remote origin # Compare against remote
wt config --global fetch_interval 5m # Fetch throttlingSee User Configuration for details.
Hooks run custom scripts at key points in the worktree lifecycle:
| Hook | When it runs |
|---|---|
pre_create |
Before worktree creation |
post_create |
After worktree creation |
pre_delete |
Before worktree deletion |
post_delete |
After worktree deletion |
info |
During wt info and wt list -v |
All hooks receive environment variables like WT_NAME, WT_PATH, WT_BRANCH, and WT_INDEX.
See the Hooks Guide for configuration and examples.
LLM coding agents work best with full access to build, test, and run your project. But running multiple agents on the same codebase creates conflicts: port collisions, shared state, and dependency issues.
wt solves this with lifecycle hooks that automatically configure each worktree:
- Unique ports: Assign dev server ports based on
WT_INDEX - Copied dependencies: Clone
node_modulesso each worktree is immediately runnable - Custom setup: Run any project-specific initialization scripts
Each agent gets a fully isolated environment where it can build, test, and iterate without affecting others. See the Vite port demo for a working example.
Compare against remote: By default, wt compares branches locally. Set remote to compare against the remote tracking branch instead, so merge status reflects what's actually been pushed:
wt config --global remote originTune fetch frequency: When remote is set, wt fetches at most every 5 minutes. Adjust with fetch_interval:
wt config --global fetch_interval 10m # Less frequent
wt config --global fetch_interval 0 # Always fetchSee User Configuration for all options.
See CONTRIBUTING.md for development setup and guidelines.
MIT