Git worktree management CLI.
curl -sSL https://raw.githubusercontent.com/jorgensandhaug/wt-cli/main/install.sh | bashgitjq(brew install jqon macOS,apt install jqon Ubuntu)- bash, zsh, or fish
curl -sSL https://raw.githubusercontent.com/jorgensandhaug/wt-cli/main/uninstall.sh | bash| Command | Description |
|---|---|
wt new <branch> |
Create new worktree with new branch |
wt new -b <branch> |
Create worktree from existing branch (auto-fetches) |
wt new -p <pr> |
Create worktree from GitHub PR (requires gh CLI) |
wt new -u <branch> |
Create worktree and run 'up' commands |
wt ls |
List all worktrees with colored status |
wt cd [name] |
cd to worktree (main if no name) |
wt up |
Spin up dev environment (run 'up' commands) |
wt down |
Spin down dev environment (run 'down' commands) |
wt rm [name] |
Remove worktree (current if no name given) |
wt rm -f [name] |
Force remove (ignores dirty/unpushed warnings) |
wt purge |
Interactive cleanup of clean worktrees |
wt prune |
Clean stale worktree references |
wt config |
Show config file path |
wt update |
Self-update to latest version |
wt version |
Show version |
parent/
myrepo/
.worktrees/
myrepo/
feature-x/
bugfix/login/
wt ls shows status:
[ok]- Clean and pushed[unpushed]- Has unpushed commits[dirty]- Has uncommitted changes
~/.config/wt/config.json:
{
"command": "claude --dangerously-skip-permissions"
}The command runs after creating a new worktree.
.cursor/worktrees.json:
{
"setup-worktree": ["npm install", "cp .env.example .env"],
"up": ["docker-compose up -d", "npm run dev &"],
"down": ["docker-compose down"],
"cleanup-worktree": ["rm -rf node_modules"]
}setup-worktree: Runs after creating worktree (always)up: Runs withwt uporwt new -u(spin up services)down: Runs withwt down(spin down services)cleanup-worktree: Runs before removing worktree (always)
See docs/CONFIGURATION.md for details.
# Start a new feature
wt new auth-refactor
# Start a feature and spin up dev environment
wt new -u auth-refactor
# Work on an existing remote branch
wt new -b origin/feature-api
# Review a PR
wt new -p 123
# See all worktrees
wt ls
# Switch worktrees
wt cd feature-api
# Go back to main
wt cd
# Spin up dev environment
wt up
# Spin down dev environment
wt down
# Done with feature - remove current worktree
wt rm
# Clean up all finished worktrees
wt purge
# Update wt-cli
wt updateSee docs/EXAMPLES.md for more examples.
See CONTRIBUTING.md.