Chapter 3: Version control

Worktree

Also called git worktree

A second working folder attached to the same repository, on its own branch. The folders share one history, but each has its own files, its own staged changes, and its own idea of which branch is current.

Two agents in one folder interfere without any error: one switches branch under the other, and a commit picks up files it shouldn't have. A worktree for each agent stops that, and it is much lighter than a full clone. Files git ignores, such as .env and node_modules, aren't there until you add them.

Say it to your agent

“Make a worktree for this task with git worktree add ../app-search -b search, install dependencies there, and work only in that folder. When it is merged, remove it with git worktree remove ../app-search.”

The workshop

Name a word, or describe what you mean in everyday language.