Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

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 main
  • git 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