Skip to content

Commit 8645848

Browse files
os-litantclaude
andauthored
chore(repo): ignore .worktrees/ so an agent worktree inside the checkout is not untracked (#17468)
`.gitignore:129` carried `.claude/worktrees/` and nothing else, so a linked worktree created at `<checkout>/.worktrees/NAME` — one of five registered worktrees in a live container chose that path — showed up as `?? .worktrees/`. A stop hook that asks for untracked files to be committed then points at the one kind of path that must never be committed: the directory holds a `.git` FILE whose content is `gitdir: /abs/path/.git/worktrees/NAME`, an absolute pointer into one container's administrative state, plus a whole second checkout of the repository. Measured in a dedicated worktree, before and after: git worktree add .worktrees/scratch HEAD git status --porcelain before: `?? .worktrees/` after: clean git check-ignore -v .worktrees before: exit 1 (no match) after: exit 0, `.gitignore:131:.worktrees/` The entry is the exact directory name, dot-prefixed and directory-only, in the same unanchored form as its neighbour `.codex/`. It matches `.worktrees/` at any depth and nothing else: `worktrees/`, `my-worktrees/`, `.worktrees-backup/` and `docs/worktrees/` all still read as not ignored. Claude-Session: https://claude.ai/code/session_01YKEjmbYNvYWJvWGSWx26zK Co-authored-by: Claude <noreply@anthropic.com>
1 parent fa23d69 commit 8645848

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,6 @@ examples/app-crm/storage/
126126

127127
# Local agent tooling
128128
.codex/
129-
.claude/worktrees/
129+
.claude/worktrees/
130+
# an agent worktree is git plumbing, never repo content: a `.git` FILE reading `gitdir:` plus a whole second checkout
131+
.worktrees/

0 commit comments

Comments
 (0)