
TL;DR
Git worktrees, often seen as isolated environments for coding agents, actually lack true isolation, allowing agents to interfere with each other. This misconception can lead to security risks and unintended consequences in collaborative coding environments.
✦ Why It Matters
Review your use of Git worktrees to ensure they meet your security and isolation needs.
Key Takeaways
How It Works
Git worktrees allow multiple working directories to share a single .git directory, but this means they also share critical components like hooks and configuration files. When an agent installs a hook in a worktree, it affects the parent repository, leading to potential security risks and unintended behavior.
In contrast, a shared clone maintains a separate configuration and hooks, providing a safer environment for running multiple agents.
Related