CLI tool for managing git worktrees with AI coding assistants
npm install worktree-launcherA CLI tool for managing git worktrees with AI coding assistants.
When working on multiple features or reviewing PRs, developers often need isolated environments. Git worktrees solve this by allowing multiple working directories from a single repository, but the workflow is clunky:
``bash`The manual way
git worktree add ../myproject-feature-auth feature-auth
cp .env ../myproject-feature-auth/.env
cp .env.local ../myproject-feature-auth/.env.local
cd ../myproject-feature-auth
npm install
claude # or codex
This gets tedious fast. Tools like Conductor exist to manage this complexity, but they add overhead for simple use cases.
wt streamlines the entire workflow into a single command:
`bash`
wt new feature-auth
This creates the worktree, copies your environment files, and launches your AI coding assistant in the new directory.
`bash`
npm install -g worktree-launcher
Requires Node.js 18+ and git.
Run wt with no arguments to open a terminal UI:
`bash`
wt
The TUI shows your repo name, current branch, and all existing worktrees.
| Key | Action |
|-----|--------|
| n | Create new worktree |d
| | Delete selected worktree |c
| | Launch Claude Code in selected worktree |x
| | Launch Codex in selected worktree |p
| | Push selected branch to remote |Enter
| | Print cd command for selected worktree |r
| | Refresh worktree list |q
| | Quit |
Navigate with arrow keys or vim-style j/k.
Press n to create a new worktree:
1. Enter the branch name
2. Choose AI tool to launch (Claude Code, Codex, or Skip)
The worktree is created from your current branch, .env files are copied automatically.
Run with no arguments for interactive mode.
`bash`
wt
Create a new worktree and optionally launch an AI assistant.
`bash`
wt new
Options:
- -i, --install - Run package manager install after creating worktree-s, --skip-launch
- - Create worktree without launching AI assistant-p, --push
- - Push branch to remote (makes it visible on GitHub immediately)
Examples:
`bashCreate worktree and launch AI selector
wt new feature-auth
The worktree is created at
../. For example, if you run wt new feature-auth in /code/myproject, the worktree is created at /code/myproject-feature-auth.$3
List all worktrees for the current repository.
`bash
wt list
or
wt ls
`Output shows path, branch, and status (active, merged, local only).
$3
Interactively remove worktrees for merged or deleted branches.
`bash
wt clean
`This finds stale worktrees, shows an interactive selection, and removes the ones you choose.
$3
Remove a specific worktree.
`bash
wt remove [options]
or
wt rm
`Options:
-
-f, --force - Force removal even with uncommitted changesWorkflow
A typical development workflow:
`bash
1. Start in your main repository
cd ~/code/myproject2. Open interactive mode to see all worktrees
wt3. Or create a worktree directly
wt new feature-user-auth
Select Claude Code or Codex from the prompt
AI assistant launches in the new worktree
4. Work on the feature, commit, push, create PR
5. After PR is merged, clean up
wt clean
Select merged branches to remove
`Environment Files
The following files are automatically copied to new worktrees:
-
.env
- .env.local
- .env.development
- .env.development.local
- .env.test
- .env.test.local
- .env.production
- .env.production.local
- Any other .env.* filesTemplate files (
.env.example, .env.sample, .env.template) are excluded.AI Assistants
Currently supports:
- Claude Code
- Codex
The tool checks if your selected assistant is installed before launching. If not found, the worktree is still created and you can launch manually.
Security
Branch names are validated to prevent:
- Path traversal attacks (
.. sequences)
- Git flag injection (names starting with -`)MIT