git-wt is a zsh-native Git worktree workflow plugin.
Goals:
- Explicit, safe, predictable worktree operations
- Closed command set (no dynamic subcommands)
- Completion is first-class
- zsh 5.0+
- git 2.5+ (worktree support)
zinit light fingergohappy/git-wtCompletion notes:
- This plugin registers
compdef _git-wt git-wtwhencompdefis available. - Ensure you run
compinitin your.zshrc(only once).
Clone into your custom plugins directory:
git clone https://github.com/fingergohappy/git-wt "$HOME/.oh-my-zsh/custom/plugins/git-wt"Enable it:
plugins+=(git-wt)Clone somewhere and source the entry file:
git clone https://github.com/fingergohappy/git-wt ~/.config/zsh/plugins/git-wt
source ~/.config/zsh/plugins/git-wt/git-wt.plugin.zshThe plugin uses a dedicated worktree root directory (default naming: <project>-work-tree) to store feature worktrees.
From a parent directory (recommended):
cd ~/code
# create or reuse repo + prompt to create worktree root
# - `git-wt init my-repo` initializes ./my-repo (git init if needed)
# - `git-wt init https://github.com/org/repo.git` clones if missing
# - `git-wt init` can also work when you are already inside a repo
git-wt init my-repoRun from the project root:
cd ~/code/my-repo
git-wt create my-feature
# or: create + cd into the worktree
# git-wt cs my-featuregit-wt switch my-feature
# alias:
# git-wt enter my-feature
# git-wt cd my-featuregit-wt rootgit-wt is a shell function (not a script) so that switch/root can change your current directory.
create <feature> create new worktree + branch
switch <feature> cd to feature worktree
enter <feature> alias of switch
cd <feature> alias of switch
root cd back to project root
remove <feature> remove feature worktree
rm alias of remove
list list feature worktrees (tab-separated)
ls alias of list
status show current context status
merge <feature> merge feature branch into root
rebase <feature> rebase root onto feature
config ai <command...> set default AI command (session-only)
config editor <command...> set default editor command (session-only)
config work-tree-name <n> override worktree root name (session-only)
init [project|url] initialize repo and worktree root
a [--ai <provider>] <feature> [args...] open feature with AI agent
ca [--ai <provider>] <feature> [args...] create and open with AI
e <feature> open feature with editor
ce <feature> create and open with editor
cs <feature> create and switch
- Feature names must be explicit and valid:
- disallows:
.,..,current - disallows:
/in feature name
- disallows:
- Destructive operations require explicit arguments (e.g.
remove <feature>).
There are two ways to open a worktree with external tools:
- Explicit provider (recommended):
git-wt a --ai claude my-feature --model opus- Configure a default command (session-only):
git-wt config ai "claude --model opus"
# then:
# git-wt a my-feature
git-wt config editor nvim
# then:
# git-wt e my-featureCompletion is provided by completions/_git-wt.
If completion does not work:
- confirm
compinitis executed in your shell startup - restart your shell
MIT