wt - Git Worktree Manager

A fast, simple Git worktree helper written in Go.
Inspired by haacked/dotfiles/tree-me.

Features
- Configurable worktree strategies:
global, sibling-repo, parent-branches, and more
- Clone into organized locations —
wt clone acquires a repo under repo_root (<host>/<owner>/<repo>/<branch>), ready to inspect
- Simple commands for common worktree operations
- Interactive selection menus with fuzzy matching for checkout, cd, remove, pr, and mr commands
- GitHub PR support via
wt pr command (uses gh CLI) — checks out the PR's actual branch name
- GitLab MR support via
wt mr command (uses glab CLI) — checks out the MR's actual branch name
- Built-in file copy — declare
.env and friends in [files] or a committed .worktreeinclude; copied with a reflink on APFS/Btrfs/XFS, so even node_modules costs metadata rather than disk
- Pre/post command hooks — run custom scripts on create/checkout/remove/clone (e.g. launch AI assistants, share build caches, assign dev server ports, init submodules)
- Stale worktree detection — find worktrees with deleted remote branches or inactive commits (
wt cleanup --stale)
- Color-coded status output — green (clean), red (dirty), yellow (ahead/behind), bold cyan (current); respects
NO_COLOR=1 and auto-strips colors when piped
- CI/CD status integration —
wt status --ci shows pipeline status (✓/✗/●) per branch via gh or glab CLI
- Per-repo
.wt.toml config — override global settings (strategy, hooks, etc.) on a per-repository basis
git config support — keep personal settings in .git/config or ~/.gitconfig, with no extra file to gitignore
- Shell integration with auto-cd functionality
- Tab completion for Bash, Zsh, and Fish
Quick Start
brew install timvw/tap/wt # or: go install github.com/timvw/wt@latest
wt init # configure shell integration
See docs/installation.md for all platforms (Scoop, WinGet, Linux packages, from source).
Usage
Clone
# Acquire the main repository, ready to inspect. Placed under repo_root as
# <repo_root>/<host>/<owner>/<repo>/<default-branch>, left on its default branch
# (that trailing segment makes the clone a normal worktree slot, so wt create
# later puts siblings next to it).
wt clone timvw/wt # owner/repo resolved via gh/glab
wt clone [email protected]:me/dotfiles.git # full URL used as-is
wt clone acme/api ~/src/api # explicit destination
Two settings control placement: repo_root (default ~/dev/repos) and
repo_pattern. Grouping levels like "work" vs "personal" are yours to define —
put an env var in the pattern with a :- default so it works even when unset:
repo_pattern = "{.repoRoot}/{.env.WT_CATEGORY:-personal}/{.repo.Owner}/{.repo.Name}/{.branch}"
WT_CATEGORY=work wt clone acme/api # ~/dev/repos/work/acme/api/main
wt clone timvw/wt # ~/dev/repos/personal/timvw/wt/main (default)
To set the category for a whole tree of repos instead of per command, add a
[[context]] rule:
[[context]]
when_path = "~/dev/repos/work"
env = { WT_CATEGORY = "work" }
Every wt command operating on a repo under that path then resolves work,
including wt create from a worktree in a different tree. The same rule can go
in ~/.gitconfig instead, if you would rather not keep a config file:
git config --global wt.context.work.whenpath "~/dev/repos/work"
git config --global --add wt.context.work.env "WT_CATEGORY=work"
See Setting the category per directory.
Checkout & Create
# Checkout existing branch in new worktree
wt co feature-branch
wt co # interactive: fuzzy-search from available branches