Worktree

Simple Definition

A worktree is a separate working copy of a code project that lets developers or AI agents work on different tasks without overwriting each other.

It is like giving each coding agent its own safe workspace.

Why It Matters

When several agents work at once, they can collide, editing the same files and undoing each other’s changes. Worktrees keep each task isolated on its own branch, which makes parallel work safer and review cleaner.

Example

One AI agent fixes a bug in one worktree while another agent builds a new feature in a separate worktree. Neither overwrites the other’s work, and you can review each change on its own.

Continue learning

Explore related guides, tools, workflows, and prompts that help you go deeper into this topic.

See AI terms in action

Browse practical AI workflows that use the concepts in this glossary.

Last updated: