git-wt
Fast, reliable git worktree management
- Language
- Go
- Version
- 0.12.0
- License
- MIT
- Category
- Dev Tool
A CLI tool for managing git worktrees with automatic setup, configuration copying, and interactive navigation. It automates branch creation, safely removes worktrees with cleanup, and syncs configuration files across worktrees.
Preview
Features
Create worktrees with automatic branch creation and config copying (default layout: <repo>/.worktrees/<leaf>/)
Add command for existing branches — local or remote refs (auto-creates tracking branch)
Eject — move the currently-checked-out branch into a new worktree, stashing & restoring uncommitted changes, then switch main tree back to main/master
Remove worktrees safely with multi-select support and branch cleanup
Interactive navigation between worktrees sorted by modification time
Auto-syncs .env, .claude, CLAUDE.local.md, and .ai-cache to new worktrees (customizable via .git-wt-copy-files)
Clean stale worktrees for branches deleted from remote (orphaned or upstream-gone, with auto fetch --prune)
Persistent settings via git config wt.* with ${repo}/${repoPath}/${repoParent}/${home} templating
Shell tab-completion — bash/zsh/fish/PowerShell with dynamic candidate completion
Shell alias generation with configurable file descriptor (fd3 by default), auto-bound completion
Nested subdirectories for branch names with slashes
Bare mode — works without shell alias, outputs paths for copy-paste or piping
Zero runtime dependencies (except git)
Install
Homebrew
$ brew install shhac/tap/git-wt GitHub Release (macOS)
$ curl -L https://github.com/shhac/git-wt/releases/latest/download/git-wt-macos-universal.tar.gz | tar xz Build from Source
$ git clone https://github.com/shhac/git-wt.git && cd git-wt && go build -o git-wt ./cmd/git-wt Getting Started
CLI tools run as subprocesses and can't change your shell's working directory. The gwt shell alias wraps git-wt with a file descriptor mechanism so that commands like new and go actually navigate your shell to the worktree.
01 · Add the alias to your shell config
$ echo 'eval "$(git-wt alias gwt)"' >> ~/.zshrc For bash, use ~/.bashrc instead. You can replace gwt with any name you prefer.
02 · Reload your shell
$ source ~/.zshrc 03 · Use gwt for all commands
gwt new and gwt go will change your shell's directory. Other commands like list and clean pass through unchanged.
Usage
$ gwt new feature/auth-system $ gwt add origin/paul/auth-bug $ gwt eject $ gwt go $ gwt rm $ gwt list --plain $ gwt clean --dry-run