Worktree Management
pertmux integrates with worktrunk (wt) to provide full worktree lifecycle management from within the TUI.
Prerequisites
Section titled “Prerequisites”Install worktrunk and ensure wt is on your PATH:
cargo install worktrunkWorktree panel
Section titled “Worktree panel”The worktree panel is rendered at the top of the dashboard, with the MR list below it. The worktree panel is default focused when you open the dashboard.
Each worktree card shows:
- Branch name with ahead/behind indicators
- Last commit message
- Commit age (e.g., “2h ago”, “3d ago”)
- Git status symbols (modified, staged, untracked files)
Actions
Section titled “Actions”| Key | Action |
|---|---|
Tab | Switch between worktree panel and MR list |
c | Create a new worktree |
w | Create a new worktree and inject a prompt into the agent |
d | Delete selected worktree |
M | Merge selected worktree into the default branch |
Enter | Jump to the worktree’s tmux pane |
Create workflow
Section titled “Create workflow”When you press c, pertmux opens a popup dialog where you enter the branch name. It then runs wt create to:
- Show an in-progress toast (“Creating worktree…”)
- Create a new worktree directory
- Create and checkout the branch
- Automatically refresh the dashboard (MR linking updates immediately)
Create with prompt {#create-with-prompt}
Section titled “Create with prompt {#create-with-prompt}”When default_worktree_with_prompt is set in your config, pressing w opens a two-field dialog:
- Branch name — the git branch to create
- Message — the prompt to inject into the agent command
pertmux substitutes your message into the {{msg}} placeholder of the template, then:
- Creates the worktree (same as
c) - Opens a split tmux pane running the filled command (e.g.
opencode run implement the feature)
Configuration
Section titled “Configuration”default_worktree_with_prompt = "opencode run {{msg}}"The {{msg}} placeholder is replaced with the message you type in the dialog. The resulting command is run in the left pane of a horizontal tmux split; the right pane opens an empty terminal in the worktree directory.
Example
Section titled “Example”With default_worktree_with_prompt = "opencode run {{msg}}":
- Press
win the worktrees panel - Enter branch name:
feat/login-page - Enter message:
implement the user login page with email and password fields - Press Enter
pertmux creates the feat/login-page worktree and opens a tmux pane running:
opencode run implement the user login page with email and password fieldsMerge workflow
Section titled “Merge workflow”Press M on a worktree to merge it into the default branch. pertmux runs wt merge which:
- Show an in-progress toast (“Merging worktree…”)
- Merges the branch into the default branch
- Cleans up the worktree directory
- Removes the local branch
- Automatically refresh the dashboard
Split pane with agent
Section titled “Split pane with agent”When the default_agent_command is set in your config, pressing Enter on a worktree creates a horizontal split in tmux:
- Left pane: Runs the specified agent command (e.g.,
opencode) - Right pane: Opens an empty terminal in the worktree directory
This allows you to start working with an agent immediately upon focusing a worktree.