worktree
A working directory management mechanism provided by Git that allows multiple independent working trees to be created from the same repository, sharing the .git object store while each having its own branch and staging area.
Core Facts
Timeline (last 90 days)
Isolated workspaces are typically implemented in Git through short-lived branches or worktrees; accompanying ephemeral worktrees and sandboxed execution environments can ensure that an Agent's intermediate commits are not accidentally pushed to the remote.
AVP's naming draws directly on Git's underlying concepts (such as worktree), and its design approach is built on top of the Git ecosystem.
The Agent Arena feature can have up to five models work on the same task in parallel within the Alibaba environment, each running in an independent worktree, with only the winner's code applied to the main workspace.
Claude Code automatically removes a clean worktree when exiting an unnamed interactive session, while for named sessions it asks first.
Codex keeps the 15 most recent worktrees by default and deletes older ones once that is exceeded.
Git only removes clean worktrees—no untracked files, no modified tracked files; unclean worktrees require `--force`, and locked ones require `--force` twice.
Claude Code locks the worktree while the agent is running and releases it when the agent finishes; locks left by killed sessions are only released on a subsequent scan.
In the tool.call hook, when the agent attempts to edit code outside its worktree, the operation is paused and awaits human confirmation; if there is no response, execution is denied by default.
In the ADE scenario, the value of worktrees is that they let multiple agents modify different copies of the same project in parallel, avoiding overwriting each other's files or causing lock conflicts; without worktrees, multi-agent parallelism degrades into fighting over files in the same directory.
In herdr, fan-out is a Claude Code skill that can create multiple git worktrees for one prompt, launch multiple agents, prompt them in parallel, have each run tests, and finally generate a comparison table, and nothing is merged without the user's approval.
1 more timeline events
All Facts (11)
Deleting a worktree should use git worktree remove rather than directly rm -rf, otherwise metadata will remain in .git/worktrees and need to be cleaned up with git worktree prune.
65%UnverifiedIsolated workspaces are typically implemented in Git through short-lived branches or worktrees; accompanying ephemeral worktrees and sandboxed execution environments can ensure that an Agent's intermediate commits are not accidentally pushed to the remote.
50%UnverifiedAVP's naming draws directly on Git's underlying concepts (such as worktree), and its design approach is built on top of the Git ecosystem.
50%UnverifiedThe Agent Arena feature can have up to five models work on the same task in parallel within the Alibaba environment, each running in an independent worktree, with only the winner's code applied to the main workspace.
50%UnverifiedGit only removes clean worktrees—no untracked files, no modified tracked files; unclean worktrees require `--force`, and locked ones require `--force` twice.
50%UnverifiedClaude Code locks the worktree while the agent is running and releases it when the agent finishes; locks left by killed sessions are only released on a subsequent scan.
50%UnverifiedClaude Code automatically removes a clean worktree when exiting an unnamed interactive session, while for named sessions it asks first.
50%UnverifiedCodex keeps the 15 most recent worktrees by default and deletes older ones once that is exceeded.
50%UnverifiedIn the tool.call hook, when the agent attempts to edit code outside its worktree, the operation is paused and awaits human confirmation; if there is no response, execution is denied by default.
50%UnverifiedIn the ADE scenario, the value of worktrees is that they let multiple agents modify different copies of the same project in parallel, avoiding overwriting each other's files or causing lock conflicts; without worktrees, multi-agent parallelism degrades into fighting over files in the same directory.
50%UnverifiedIn herdr, fan-out is a Claude Code skill that can create multiple git worktrees for one prompt, launch multiple agents, prompt them in parallel, have each run tests, and finally generate a comparison table, and nothing is merged without the user's approval.
50%