Skip to content

Worktrees

xmsadik edited this page Nov 29, 2026 · 1 revision

Worktrees let several agents work on one repository without touching each other's files. Each agent gets its own git worktree, a second checkout of the repository on its own branch. You compare, merge and clean up from Kotilo. It works with every agent, not only those with a worktree option of their own.

Start an agent in a worktree

Choose New agent in worktree… from the workspace's right-click menu, the terminal's New agent menu, the command palette or the Worktrees panel in Mission control. Give it a name and pick the agent.

New agent in worktree: a name, the folder and branch it creates, and the agent

Kotilo then:

  1. creates .kotilo/worktrees/<name> on the branch kotilo/<name> (the prefix is in Settings → Terminal), starting from the main checkout's current commit;
  2. opens a terminal tab there running the agent;
  3. shows the branch as a badge on the tab, the agent header and the Mission control tile.

The worktree branch shown as a badge on the agent's tab and header

Kotilo hides .kotilo/ from git through the repository's own .git/info/exclude (except .kotilo/docs.toml); your .gitignore is not changed. Worktree files stay out of the file tree and quick open.

Requirements: the workspace must be the repository's top folder and have at least one commit.

The Worktrees panel

In Mission control, under the tiles, each worktree has a row with its branch, the agents running in it, uncommitted files, commits ahead of and behind the base branch, and changed lines. Worktrees created by other tools inside the workspace (for example .claude/worktrees/) are listed too, for terminals and compare only.

The Worktrees panel with three worktrees, their state and actions

Action What it does
Open terminal A new terminal tab in the worktree
Compare Lists everything the worktree changed (commits and uncommitted work) since it left the base branch. Each file opens in the diff view, where review notes work as usual.
Merge Brings the branch into its base branch in the main checkout, as a merge commit or one squashed commit. Nothing is pushed.
Remove Closes the worktree's tabs, then deletes the folder and, if you choose, the branch. Uncommitted or unmerged work needs an extra confirmation.

Compare lists the files changed in the worktree

Merge rules. Merge refuses while the main checkout or the worktree has uncommitted changes; ask the agent to commit first. If the merge has conflicts it is undone and the conflicting files are listed. Resolve them in a terminal, for example by merging the base into the worktree, then try again.

A merge with conflicts is undone and the files are listed

Sessions of worktree agents count under the main project in Usage, Sessions and Projects. Resuming one from Sessions opens the terminal in its worktree.

Clone this wiki locally