A tmux plugin for switching git branches and managing git worktrees from a popup with fzf.
Add the plugin to ~/.tmux.conf:
set -g @plugin 'YlanAllouche/treemux'Reload tmux and install plugins with prefix + I.
This replaces:
bind-key b display-popup -E -w 80% -h 60% -d '#{pane_current_path}' "~/.local/bin/git-branch-switcher"
bind-key B display-popup -E -w 80% -h 60% -d '#{pane_current_path}' "~/.local/bin/git-branch-switcher --delete"prefix + bopens branch switching mode.prefix + Bopens delete mode.- Popup width is
80%. - Popup height is
60%.
set -g @treemux_key 'b'
set -g @treemux_delete_key 'B'
set -g @treemux_width '80%'
set -g @treemux_height '60%'
set -g @treemux_python 'python3'
set -g @treemux_base_branch ''
set -g @treemux_debug '0'Set @treemux_key or @treemux_delete_key to none to disable a binding.
@treemux_base_branch overrides automatic default-branch detection.
@treemux_debug writes logs to /tmp/git-branch-switcher.log.
- In a regular repository, it switches to an existing branch or creates a new one.
- In bare repositories and linked worktrees, it manages worktrees under
<bare-repo>/workspaces. - Delete mode deletes the local branch in a regular repository.
- Delete mode removes only the worktree in bare and linked-worktree mode.
- When a new tmux window is created for a worktree, the plugin opens
$EDITORthere.
The plugin still honors GBS_BASE, GBS_BASE_BRANCH, GBS_DEBUG, and GBS_DELETE if they are already part of your setup.
- tmux with
display-popupsupport gitfzfbash- Python 3.8+