Agenti di coding in parallelo senza conflitti: Git Worktrees
Описание и применение
Использование Git worktree позволяет каждому агенту работать в изолированной папке и ветке, устраняя конфликты файлов и лишние операции push/pull. Интеграция выполняется локальным слиянием веток.
Задача
Multiple coding agents working on the same repository, branch, and working directory overwrite each other’s changes, causing chaos and loss of context.
Результат
Using Git worktrees isolates each coding agent’s environment, eliminating file conflicts and unnecessary network traffic. Integration becomes a local merge of branches, simplifying CI and audit trails.
Рабочий процесс
- Create a worktree for each agent:
git worktree add ../feature-login -b feature/login main git worktree add ../feature-payments -b feature/payments maingit worktree add ../integration -b integration main- Develop in the agent’s worktree:
cd ../feature-login && git add . && git commit -m "feat: login" - Merge into integration:
cd ../integration && git merge feature/login && git merge feature/payments && npm test - Remove the agent’s worktree after completion:
git worktree remove ../feature-login && git branch -d feature/login
Доказательства
git worktree add ../feature-login -b feature/login main
git merge feature/login git merge feature/payments npm test
- Дата записи: 2026-09-08T12:45:29.864Z