---
title: "What is a git worktree, and why agents need them"
url: https://helicon.sh/glossary/git-worktree
description: "A git worktree is a second working directory for the same repository. It is the cheapest way to stop two coding agents from editing the same files."
updated: 2026-09-19
site: Helicon
---

# What is a git worktree, and why agents need them

A git worktree is an additional working directory attached to the same repository, each on its own branch. For coding agents it is the cheapest real isolation available: two agents in two worktrees cannot edit the same files, and neither needs a full clone of the repository.

## The command

One line per task, and each agent gets a directory of its own on its own branch.

```sh
git worktree add ../proj-auth -b feat/auth
```

## Why not just branches

- A branch is a pointer. A worktree is a directory. Agents edit directories.
- Switching branches in one checkout while an agent is mid task corrupts its view of the world.
- Worktrees share the object store, so they cost far less disk than clones.

## How a GUI should treat them

As separate projects. A worktree is a different working directory, so its sessions belong to it. Helicon lists each worktree with a badge under its own entry, which is what makes parallel work legible.

## Frequently asked questions

### Do worktrees use a lot of disk?

Much less than clones, because they share the repository's object store.

### Can two agents share one worktree?

They can, and they will collide. One worktree per agent is the point.

### How does Helicon show them?

As their own projects in the sidebar, badged as worktrees, with their sessions underneath.

## Related

- [Projects and worktrees](https://helicon.sh/features/projects-and-worktrees): Helicon groups every Muse Code thread under the directory the agent worked in, isolated git worktrees included, so parallel work across repositories has one place to live.
- [Parallel agents in worktrees](https://helicon.sh/guides/run-parallel-agents): Use isolated git worktrees so parallel agents never collide, then watch all of them from one sidebar that shows which threads are running and which are blocked.
- [Running agents in parallel](https://helicon.sh/use-cases/parallel-agents): Isolated worktrees, one sidebar, and clear marks for which thread is running, finished, or blocked on you. Plus the cost of all that parallelism, per thread.

---

Helicon is a free, MIT licensed, unofficial community client for Meta's Muse Code CLI. Not made, sponsored or endorsed by Meta. Source: https://helicon.sh/. Machine readable index: https://helicon.sh/llms.txt
