NachschlagenQuellenregister

Dokumentationerreichbar

Anthropic, Run parallel sessions with worktrees

code.claude.com (externe Seite)

Die Her­stel­ler­do­ku­men­ta­tion zu getrennten Worktrees: ein zweites Arbeits­ver­zeichnis mit eigenen Dateien und eigenem Branch auf derselben Historie. Sie belegt die Antwort auf die Frage, wie zwei Agenten gleichzeitig an einem Projekt arbeiten können, ohne sich in die Quere zu kommen, und nennt die Kanten: Ein frischer Auscheckvorgang hat die nicht committeten Dateien nicht dabei, und aufgeräumt wird nur, was keine Arbeit mehr enthält. Für die Mitnahmeliste steht das Beispiel des Herstellers selbst da, und es besteht aus zwei Umgebungsdateien und einer Datei mit Zugangsdaten. Ein neuer Worktree zweigt in der Voreinstellung vom Standardzweig auf dem Server ab, ein Schalter stellt ihn auf den lokalen Stand um.

geprüft 10.11.2026

Worauf sich diese Seite beruft, wörtlich, abgerufen am 08.10.2026:

  • Running each Claude Code session in its own worktree gives it a separate copy of the files to edit, so one session can build a feature while a second fixes a bug.bestätigt 10.11.2026
  • Only files that match a pattern and are also gitignored are copied, so tracked files are never duplicated.bestätigt 10.11.2026
  • This .worktreeinclude copies two env files and a secrets config into each new worktreebestätigt 10.11.2026
  • None of them tracks which files a shell command writesbestätigt 10.11.2026
  • The same enforcement covers every subagent Claude spawns from the isolated session.bestätigt 10.11.2026
  • Claude sees each refusal as a tool error that names the worktree and says how to proceed.bestätigt 10.11.2026
  • Non-interactive runs with -p have no exit prompt, so Claude doesn't clean up their worktreesbestätigt 10.11.2026
  • so that concurrent cleanup can't remove it, and releases the lock when the agent finishesbestätigt 10.11.2026
  • If a worktree with the name you pass to --worktree already exists, Claude Code opens it instead of creating a new one.bestätigt 10.11.2026
  • a worktree that Claude Code creates contains LFS pointer files instead of the real filesbestätigt 10.11.2026
  • A worktree gets its own files and branch, but it shares the following with the main checkoutbestätigt 10.11.2026
  • Once the key is on, Claude Code removes both worktree tools or refuses calls to them.bestätigt 10.11.2026
  • The errors belongs to a different repository and is a leftover worktree both mean git ties the directory for the worktree name you passed to another location.bestätigt 10.11.2026

04 Versionierung21 Parallel arbeiten

Alle Quellen

↑↓ auswählenEnter öffnenDie Suche läuft im Browser. Nichts wird übertragen.