Jump between the git worktrees of the current repository.
wtree reads the worktrees of the current repository from git worktree list, lets you pick one, and cds into it. If fzf is installed you get a fuzzy list with a git-log preview of each worktree; otherwise it falls back to a numbered select menu. When there is only a single worktree it switches to it without prompting. The preview command is configurable.
Clone the repo and source the plugin from your .zshrc:
git clone https://github.com/seankoji-com/zsh-worktree ~/.zsh/zsh-worktree
echo 'source ~/.zsh/zsh-worktree/zsh-worktree.plugin.zsh' >> ~/.zshrczinit light seankoji-com/zsh-worktreeClone into your custom plugins directory:
git clone https://github.com/seankoji-com/zsh-worktree \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-worktreeThen add it to the plugins array in your .zshrc:
plugins=(... zsh-worktree)fzf is optional but recommended for the fuzzy picker and preview.
From inside a git repository:
wtreePick a worktree and you'll be cd'd into it. With a single worktree, wtree switches to it directly.
worktree_list is also exposed as a public helper that prints the worktree paths one per line, so you can reuse it in your own scripts.
Set before loading the plugin:
| Variable | Default | Description |
|---|---|---|
ZSH_WORKTREE_PREVIEW |
git -C {} log --oneline -5 2>/dev/null |
fzf preview command; {} is the worktree path. Set to '' to disable the preview. |
MIT — see LICENSE.