# Git worktree

URL: https://codepanel.ai/glossary/git-worktree

A separate working directory and branch linked to an existing Git repository, letting parallel coding agents edit code without overwriting each other.

A Git worktree is an additional working directory attached to a single local Git repository, checked out on its own branch while sharing the repository's `.git` object database. Coding agent runners use one worktree per run so multiple agents can edit files, run tests, and commit in parallel without touching your main checkout.

## Why worktrees matter for coding agents

Because each worktree has its own files and index, an agent cannot dirty your active branch or collide with another agent's edits. However, a worktree's `.git` file points back to the main repository's `.git` directory, so file isolation alone is not a security boundary: shell commands still need an [OS sandbox](/glossary/os-sandbox) to prevent modifying `main` or sibling branches.

See [Running coding agents in parallel with Git worktrees](/guides/git-worktrees-for-coding-agents) and [Coding agents](/coding-agents).
