Lesson 10 / 25
Parallel Agents and Git Worktrees
Run several agents at once without them overwriting each other's files.
Isolate the files too
Parallel agents editing the same working directory will collide. A git worktree gives each agent its own checkout on its own branch, sharing one repository history. Merge the branches afterwards like normal pull requests.
Two worktrees for two tasks
Each command creates a sibling folder on a new branch. Start one agent in each folder.
git worktree add ../shop-fix-login -b fix/login
git worktree add ../shop-add-search -b feat/search
git worktree listParallelise independent work only
Two tasks that touch the same files will still conflict at merge time. Split work by module or feature boundary, and expect to review each result yourself.
Quick check: What does a git worktree give each agent?
- A separate repository server
- Its own checkout and branch
- A copy of the internet
- Extra model memory
Answer
Its own checkout and branch — Separate working directories prevent agents from overwriting each other.