Simple, powerful Git worktree management with fuzzy finding
Work on multiple branches simultaneously without the pain of git stash and constant branch switching.
Before worktrees:
# Working on a feature
$ git checkout feature-branch
# ... coding ...
# Need to quickly check main
$ git stash # π° Save your work
$ git checkout main # Switch branch
# ... check something ...
$ git checkout feature-branch # Switch back
$ git stash pop # π€ Hope nothing breaksWith worktrees:
# Each branch is its own directory
$ cd ~/code/repo-feature/ # Work on feature
$ cd ~/code/repo-main/ # Check main
$ cd ~/code/repo-feature/ # Back to work
# Everything stays intact! β¨Perfect for:
- π― Working on multiple features simultaneously
- π Reviewing PRs without losing your current work
- π§ͺ Running tests on one branch while developing another
- π Comparing branches side-by-side in different editor windows
Interactive hub:
wtβ Interactive fuzzy finder to list, switch, create, and manage worktrees
Subcommands:
wt new/wt nβ Create/open a worktree for a new or existing branchwt remove/wt rmβ Safely remove a worktree (guards against uncommitted/unpushed work)wt open/wt oβ Open an existing worktree for a branchwt list/wt lsβ List worktrees with status (clean/dirty, ahead/behind)wt pruneβ Remove stale worktree referenceswt configβ Manage configuration (edit, show, init)wt helpβ Show detailed help
Quick access (shorthand):
wtnew,wtrm,wtopen,wtlsβ Direct commands (same as subcommands, just faster to type)
brew tap etiennebbeaulac/tap
brew install git-worktreesThat's it! Commands are immediately available. β¨
First Run: On your first use, git-worktrees will ask you to choose your default editor (VS Code, Cursor, IntelliJ IDEA, etc.). This one-time setup takes 5 seconds and you're good to go!
wt --help # Try it now!Updating:
brew upgrade git-worktreescurl -fsSL https://raw.githubusercontent.com/EtienneBBeaulac/git-worktrees/main/install.sh | bashThen restart your shell or run: source ~/.zshrc
For local/offline testing, you can override downloads with a local repo path:
REPO_RAW="file://$PWD" bash install.sh# Interactive hub - the main way to use git-worktrees
wt # Fuzzy-find worktrees, switch, create, manage
# Or use direct commands when you know what you want
wt new feature-branch # Create your first worktree
wt open feature-branch # Open specific worktree
wt remove # Remove a worktree safely
wt list # List all worktrees with status
# Shorthand versions (same thing, less typing)
wtnew feature-branch # Same as: wt new feature-branch
wtopen feature-branch # Same as: wt open feature-branch# Interactive hub - main interface
wt # Fuzzy-find and switch between worktrees
wt feature-x # Quick open/create for specific branch
# Subcommands - when you know what you want
wt new feature-x # Create worktree for new or existing branch
wt new feature/x -b main # Create from 'main' branch
wt open feature/x # Open existing worktree
wt list # List all worktrees with status
wt list --fzf --open # List and open selected in your editor
wt remove # Interactive removal (includes "Remove all detached")
wt remove -d ../repo-feature-x --delete-branch # Remove and delete branch
wt prune # Remove stale worktree references
wt config edit # Edit configuration file
wt config set editor "Cursor" # Change your default editor
wt config get editor # Show current editor
# Shorthand - same commands, less typing
wtnew feature-x # Same as: wt new feature-x
wtrm # Same as: wt remove
wtrm --rm-detached --yes # Bulk remove all detached worktrees- git
- fzf (optional, recommended; without it, non-interactive fallbacks are used)
-n, --nameBranch name (new or existing)-b, --baseBase ref when creating a new branch (e.g.origin/main)-d, --dirWorktree directory-r, --remoteRemote to track/push (default: infer from base ororigin)--appApp name to open (default: auto-detected from your system)--no-openDo not open in editor/IDE--pushPush new branch to selected remote and set upstream--prefer-reusePrefer reusing an existing clean worktree slot over creating new--inside-okAllow creating a path inside the current repo (unsafe)
Environment variables:
WT_EDITORorWT_APPβ Override auto-detected editor (e.g. "VS Code", "IntelliJ IDEA")EDITOR/VISUALβ Standard editor environment variables (respected)WT_FZF_OPTS,WT_FZF_HEIGHTβ Customize fzf appearanceWTNEW_ALWAYS_PUSH=1β Always push new branches by defaultWTNEW_PREFER_REUSE=1β Prefer reusing clean slots by defaultWTNEW_AUTO_OPEN=0β Disable auto-opening editorWT_DEBUG=1β Print debug info
Configuration file (~/.config/git-worktrees/config):
- Auto-created on first run with your chosen editor
- Manage with:
wt config edit,wt config set <key> <value>, orwt config get <key> - Change editor anytime:
wt config set editor "Cursor"or use Ctrl-A β "Change editor" in hub - Priority: flags > env vars > config file
wtopen [branchOrRef]Open existing worktree for branch; without an arg, show an interactive picker--listList worktrees (branch β dir) and exit--fzfForce interactive picker even if a branch is provided--no-openDon't open in editor, just print the path--app NAMEApp to open (default: auto-detected)--prune-stalePrune stale/prunable worktrees and exit--dry-runShow the directory that would be opened--exactRequire exact branch match (skip short-name normalization)--cwdPrefer matches from the current repo family when multiple
Env:
WT_APP/WT_EDITOR/EDITOR/VISUAL(see wtnew options above)WT_FZF_OPTS,WT_FZF_HEIGHT,WT_DEBUG(same as wtnew)
Subcommands:
wt new <branch>β Create/open worktreewt removeβ Remove worktreewt open <branch>β Open existing worktreewt listβ List all worktreeswt configβ Manage configuration (edit, show, init)wt --tutorialβ Interactive tutorial for beginnerswt helpβ Full documentation
Interactive hub:
- Start: list of worktrees with "β New branchβ¦" and optional "π§΅ Show detachedβ¦"
- Keys:
- Enter: open (or actions when toggled); Ctrl-E toggles Enter between open/menu (persisted)
- Ctrl-N: create (chooser: smart reuse / force reuse / new dir)
- Ctrl-D: remove; Ctrl-P: prune stale; Ctrl-A: actions; Ctrl-O: open; Ctrl-H: help
- Actions menu (Ctrl-A): Includes "Change editor", "Remove all detached", and more
- Flags:
--start list|new,--detached,--enter-default open|menu - Env:
WTHUB_ENTER_DEFAULT=open|menu,WT_TERMINAL_APPfor "Open in terminal"
Configuration:
- Config file:
~/.config/git-worktrees/config - Auto-created on first run with smart defaults
- Edit with:
wt config editor manually - Priority: flags > env vars > config file
Run the non-interactive test suite:
make test # full suite
make test-fast # quick smoke (FAST_ONLY subset)Install script:
curl -fsSL https://raw.githubusercontent.com/EtienneBBeaulac/git-worktrees/main/uninstall.sh | bashHomebrew:
brew uninstall git-worktrees
brew untap etiennebbeaulac/tap # OptionalLicense
MIT Β©