| name | wt |
| description | Use when the user mentions worktrees or when switching between parallel tasks. Manages git worktrees for isolated development. |
| user-invocable | true |
| argument-hint | ["fork|checkout|merge|list|prune"] |
Git Worktree Helper (wt)
Use wt to manage isolated workspaces for parallel feature development.
When to Use
- Starting new feature work that should be isolated from current changes
- User mentions worktrees, isolation, parallel work, or
wt commands
- Preserving dirty state while switching to urgent work
- Merging completed work back to parent branch
Core Workflows
1. Fork Current Work to New Worktree
When you need to isolate current work or start a new feature:
wt fork <name>
wt fork --clean <name>
wt fork -b <branch> <name>
wt fork --with <pattern> <name>
After forking, your shell automatically changes to the new worktree (requires shell integration).
fork only creates new branches. If there's a preexisting local or remote branch, it errors and tells you to use wt checkout <name> instead.
2. Check Out an Existing Branch
When a branch already exists and you want to work on it in a managed worktree:
wt checkout <branch>
wt co <branch>
wt checkout -p <parent> <branch>
wt checkout --with <pattern> <branch>
After checkout, your shell automatically changes to the worktree (requires shell integration).
3. Navigate Between Worktrees
wt list
wt list --all
wt path <name>
wt path
wt cd <name>
wt cd
4. Merge Work Back
When feature work is complete:
wt merge <name>
wt merge --squash <name>
wt merge --staged <name>
wt merge --base <parent-branch> <name>
Squash and rebase refuse dirty source worktrees. Use -f to discard that state. Dirty target state is stashed and restored automatically. Protected branches (main/master) default to --staged mode; -f also permits an alternate mode.
On success, worktree and branch are automatically deleted. Shell auto-cd's to the parent directory.
5. Update Worktree with Parent Changes
When parent branch has new commits you want to incorporate:
wt rebase <name>
wt rebase
wt rebase --onto <new-parent> <name>
Uncommitted changes are auto-stashed and restored.
6. Continue After a Landed PR (Rebranch)
When a worktree's branch was pushed, merged via PR/MR, and deleted on the remote — but you still have uncommitted work to continue — the worktree is landed. wt list shows landed in its STATE column.
wt rebranch <new-branch>
wt rebranch <new-branch> -w <worktree>
wt rebranch <new-branch> --onto <branch>
The directory name is preserved (so the pre-existing agent session keeps working from the same path); only the branch changes. Uncommitted changes (staged, unstaged, untracked) are carried forward. The spent branch is left behind — drop it later with wt prune --all. Committed work is never destroyed.
If restoring changes conflicts, the worktree is preserved on the new branch with conflict markers for manual resolution; the old branch stays intact.
7. Remove Worktree
wt rm <name>
wt rm -f <name>
wt rm --preserve-branch <name>
8. Prune Stale Worktrees
When a source repo is deleted, its worktree directories under ~/.wt/worktrees/ become orphaned. Prune scans globally and removes them:
wt prune
wt prune --all
wt prune --dry-run
wt prune --force
wt prune --all --force
Configuration
View/modify settings:
wt config --help
Include files: gitignored files needed in every worktree (e.g. .env) are copied via .gitignore-style patterns in .worktreeinclude (repo root) and ~/.wt/worktreeinclude (user). Copied on every fork/checkout, even with --clean.
Decision Guide
| Situation | Command |
|---|
| Start isolated feature work | wt fork feature-name |
| Work on existing branch | wt checkout branch-name |
| Urgent fix, preserve current changes | wt fork urgent-fix then work in new worktree |
| See all active worktrees | wt list (or wt list -a for all repos) |
| Incorporate upstream changes | wt rebase feature-name |
| Feature complete, merge back | wt merge feature-name |
| PR landed, continue with new work | wt rebranch next-feature |
| Abandoned work, clean up | wt rm -f old-feature |
| Orphaned worktrees after repo delete | wt prune |
| Orphaned branches from old worktrees | wt prune --all |
Shell Integration Setup
For wt cd, auto-cd on wt fork/checkout/merge/rm to work, user needs shell integration:
eval "$(wt shell zsh)"