AI agent glossary
Git worktree
A Git feature that gives one repository several working folders, each on its own branch, so multiple agents can work in parallel without colliding.
Normally a Git repository has a single working folder, and switching branches changes the files in place. A worktree adds another folder linked to the same repository, checked out to a different branch. Changes in one worktree do not touch the files in another.
This is ideal for agent work. You can run one coding agent on a bug fix in one worktree and another on a new feature in a second, at the same time, with no risk of them overwriting each other's edits. Each produces its own branch you can review and merge.
Worktrees share the repository history, so they are lighter than full clones. You still need to think about shared resources, such as databases or ports, that parallel agents might fight over.
Running git worktree add ../app-fix-login -b fix-login creates a new folder on a new branch where an agent can work on the login bug while your main folder stays untouched.
Learn more in the course
Related terms
Go from definitions to doing
Learn to use and build AI agents in 65 practical lessons.