Worktrees
How Tegment pairs every branch with its own working directory and terminals.
Tegment is built on a small, deliberate primitive: the git worktree. Every branch you care about gets its own folder and its own terminals, but they all share the same underlying repository.
Why worktrees#
You can keep several branches checked out at once and switch between them instantly, without stashing or losing terminal state. Tegment lists the repository's existing git worktrees and lets you add and remove them from the UI.
Creating a worktree#
Open the new-worktree dialog from the worktree list. You choose:
- Existing branch — check out a local or remote branch into a fresh worktree.
- New branch — create a branch and pick the base branch to fork it from.
By default the worktree folder is created next to your clone, as <repo>.worktrees/<branch>. Use Browse to put it somewhere else, or set a default location per repository in settings (see below).
After the worktree is created, Tegment runs your project's post-creation commands (for example installing dependencies) and opens a terminal pane in the new directory.
From an issue or pull request
If you've connected GitHub or Jira, you can create a worktree straight from an issue or PR in the sidebar. Tegment builds the branch name from the issue — for example PROJ-456-add-export — following the branch-name pattern set for that project.
Removing a worktree#
When you're done with a branch, delete its worktree from the worktree menu. Tegment runs git worktree remove to detach it and clean up the folder; if git refuses because the worktree is busy or dirty, you can force the removal.
If a worktree is locked (git marks it locked so it can't be pruned), Tegment can unlock it again from the same menu.
Per-repository settings#
Open Settings and select a repository to set its worktree defaults:
- Default worktree directory: where new worktrees for this repository are created. Leave it empty to use the default (
<repo>.worktrees/), or point it anywhere with Browse. - Default base branch: the branch new branches fork from when you don't pick one. Auto follows
main, thenmaster, then the first branch. - Post-creation commands: commands Tegment runs in a fresh worktree, covered in Quick actions.
When you create a worktree from a GitHub or Jira issue, the branch name comes from that integration's branch pattern, set in the repository's GitHub or Jira settings.
How worktree rows look#
Because the Terminals section handles starting work, a worktree row is primarily a git unit. Settings → Worktree controls how every row is drawn in the sidebar:
| Setting | What it controls |
|---|---|
| PR status | Show a linked pull request as a colored icon, a pill with its number, or off |
| Incoming / outgoing | Show ahead/behind (↑/↓) commit counts versus the remote |
| Line changes | Show the +insertions / -deletions indicator |
| Density | Comfortable (branch name and path on two lines) or compact (single line) |
| Hover actions | On hover, show a single menu button, or inline quick-action buttons you pick |
With Hover actions set to buttons, you choose which appear: Open terminal, Open in IDE, Launch agent, and Run template. Every action stays reachable from the right-click menu whichever style you choose.