lib/is vendored from tmux-toolkit viagit subtree; do not edit it in place, CI fails on drift. If you are an agent picking up in-flight work on this plugin, start at tmux-toolkitdocs/RESUME.md.
Beta: This plugin is under active development. Configuration options and behavior may change.
Native tmux for parallel workflows. AI agents, code reviews, tests. Each task gets its own worktree and session.
▶ Click to watch demo
Install with TPM:
# Add to ~/.tmux.conf
set -g @plugin 'KakkoiDev/tmux-worktree'Press prefix + I to install, then prefix + W to open the menu.
prefix + W → Add → select "feature/login"
Creates a worktree at ~/.tmux-worktree/myproject/feature/login and opens a new tmux session.
prefix + W → Add → Fetch remote → select "[remote] origin/fix-bug-123"
Fetches latest branches, creates a local tracking branch with its own worktree.
prefix + s → select session
Use tmux's built-in session switcher for quick navigation between open sessions.
For worktrees without an open session:
prefix + W → List → select worktree
Creates a session if needed, then switches to it.
prefix + W → Remove → select worktree to delete
Removes the worktree directory. The git branch is preserved (delete manually with git branch -D if needed).
The plugin automatically prunes stale worktree entries (directories that no longer exist) before listing. If you manually delete a worktree directory, it will be cleaned up the next time you open the menu. Git 2.30+ enables additional repair capabilities.
prefix + W → List → Filter → type "feature*" → Enter
Shows only branches matching the pattern. Supports * (any characters) and ? (single character).
| Key | Action |
|---|---|
l |
List worktrees |
a |
Add worktree |
d |
Remove worktree |
i / o |
Next / Previous page |
f |
Filter |
c |
Clear filter |
n |
New branch (in Add menu) |
r |
Fetch remote (in Add menu) |
b |
Back |
q |
Quit |
Worktrees are stored by project:
~/.tmux-worktree/
├── myproject/
│ ├── main/
│ └── feature/login/
└── other-repo/
└── bugfix/header/
Sessions are named {project}-{branch} (e.g., myproject-feature-login).
Most users don't need to configure anything. For customization:
# Change keybinding (default: W)
set -g @worktree-keybinding "T"
# Change storage path (default: ~/.tmux-worktree)
set -g @worktree-path "~/worktrees"
# Items per page (default: 15)
set -g @worktree-items-per-page "20"All keybinding options
set -g @worktree-key-list "l"
set -g @worktree-key-add "a"
set -g @worktree-key-remove "d"
set -g @worktree-key-quit "q"
set -g @worktree-key-next "i"
set -g @worktree-key-prev "o"
set -g @worktree-key-back "b"
set -g @worktree-key-filter "f"
set -g @worktree-key-clear-filter "c"
set -g @worktree-key-new "n"
set -g @worktree-key-fetch "r"Sessions created by tmux-worktree include environment variables for integration with other tools:
| Variable | Description |
|---|---|
TMUX_WORKTREE |
Set to 1 in managed sessions |
TMUX_WORKTREE_PROJECT |
Project/repository name |
TMUX_WORKTREE_BRANCH |
Branch name |
TMUX_WORKTREE_PATH |
Worktree directory path |
Example: Shell prompt
# .bashrc / .zshrc
if [ -n "$TMUX_WORKTREE" ]; then
PS1="[$TMUX_WORKTREE_PROJECT:$TMUX_WORKTREE_BRANCH] $PS1"
fiExample: Tmux statusline
set -g status-right '#{?TMUX_WORKTREE,#[fg=green]#{TMUX_WORKTREE_BRANCH},}'Menu doesn't appear: Requires tmux 3.0+. Check with tmux -V.
Fetch times out: Run git fetch origin manually. On macOS, install brew install coreutils for timeout support.
Keybinding conflict: Change with set -g @worktree-keybinding "T".
Debug mode: Enable with set -g @worktree-debug "on". Logs written to ~/.tmux-worktree/.tmux-worktree.log.
Open an issue with:
- Enable debug mode:
set -g @worktree-debug "on" - Reload tmux and reproduce the issue
- Include relevant lines from
~/.tmux-worktree/.tmux-worktree.log - Add your tmux version (
tmux -V) and OS
- tmux 3.0+
- git
- bash 3.2+
git clone https://github.com/KakkoiDev/tmux-worktree ~/.tmux/plugins/tmux-worktree
~/.tmux/plugins/tmux-worktree/install.shinstall.sh checks the dependencies and the tmux version, appends the source
line to ~/.tmux.conf, and reloads. It is idempotent, and it refuses rather than
adding a second entry if a different checkout is already sourced.
Or do it by hand, adding to ~/.tmux.conf:
run-shell ~/.tmux/plugins/tmux-worktree/worktrees.tmuxSet TMUX_CONF to install into a config other than ~/.tmux.conf.
~/.tmux/plugins/tmux-worktree/uninstall.shRemoves only the config line. Worktrees, ~/.tmux-worktree and the persisted
options are user data and are left alone; delete them by hand if you want them
gone.
Both scripts write the config with cat tmp > conf rather than mv tmp conf,
because a dotfiles-managed ~/.tmux.conf is usually a symlink and mv would
replace the link with a regular file, silently detaching every later edit.
Thanks to @Ahmed-878 for his help debugging this project.
MIT