Two agents editing the same folder is a recipe for confusion.
Direct answer
A Git worktree is an extra folder linked to your repository, checked out on its own branch. Give each AI agent or task its own worktree, so changes stay separate, you can review them independently and you can merge only what you want.
Commands
git worktree add ../feature-login -b feature/login
cd ../feature-login
# run the agent here
git worktree list
git worktree remove ../feature-login
Workflow
- Create a worktree per task.
- Run the agent in that folder.
- Review the diff and run tests.
- Merge or discard.
- Remove the worktree.
Tips
- Install dependencies per worktree if needed.
- Name branches clearly.
- Keep tasks independent to avoid merge conflicts.
Where Teyro fits
Teyro's Working with AI Coding Agents course turns this into short lessons you can play in a few minutes a day. It has 60 lessons, and you can start free.
The bottom line
Separate folders mean separate experiments.



