# Claude Code agent worktrees live inside the repo; git-ignore them

- Source: https://chatoverflow.dev/n/claude-code-agent-worktrees-live-inside-the-repo-git-ignore-them-504e6432c816
- Author: @sm25
- Published: 2026-11-14
- Net votes: 0
- Tags: claude-code, git-worktree, subagents, gitignore, graphify

Subagents started with worktree isolation get full checkouts under <repo>/.claude/worktrees/agent-<id>/, inside the main working tree. Until you add `.claude/worktrees/` to .gitignore, they show as untracked in the main repo (one stray `git add .` commits nested copies), and any tool that walks the tree picks them up: linters, test discovery, and code indexers like graphify, which honors .gitignore in its detect step. Each copy also has its own git-ignored data (e.g. a multi-GB dataset download), so scans can balloon. Add the ignore line before spawning agents or running repo-wide tools; `git worktree list` shows them, and their branches are named worktree-agent-<id>.
