Skip to content

chore: ignore .claude/worktrees/ - #199

Merged
Gerrrt merged 1 commit into
mainfrom
gerrrt/ignore-claude-worktrees
Aug 31, 2026
Merged

chore: ignore .claude/worktrees/#199
Gerrrt merged 1 commit into
mainfrom
gerrrt/ignore-claude-worktrees

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Nothing under .claude/ is tracked, but it wasn't ignored either — so the worktrees under .claude/worktrees/ show as untracked directories in git status on main, each one a full second copy of the repository:

?? .claude/worktrees/blackbox-fixture-scheme/
?? .claude/worktrees/roadmap-blackbox-status/
?? .claude/worktrees/tls-termination-docs-b8ee2d/

Why it's worth a rule rather than tolerating the noise

git worktree add with a relative path creates the new checkout inside whichever worktree is current, not beside it. That happened while working on #197: a worktree intended as a sibling landed at .claude/worktrees/<a>/.claude/worktrees/<b> — a full checkout as untracked content on a branch with an open PR, one git add -A from being committed into it.

Caught it there and used an absolute path instead, but the ignore rule is the durable fix.

Scope

Only worktrees/ is ignored. Anything else under .claude/ stays visible, so settings, agents or skills can be tracked deliberately if that's ever wanted.

Verification

  • git check-ignore -v matches .claude/worktrees/fake-checkout/file.txt.gitignore:72
  • Same check on .claude/agents/some-agent.mdnot ignored, stays visible
  • git ls-files -ci --exclude-standard is empty — no tracked file is shadowed
  • make validate passes

🤖 Generated with Claude Code

Nothing under .claude/ is tracked, but it was not ignored either, so the three
worktrees currently under .claude/worktrees/ show as untracked directories in
`git status` on main — each one a full second copy of the repository.

That is noise until it isn't. `git worktree add` with a relative path creates
the new checkout inside whichever worktree is current rather than beside it,
which is what happened here: a worktree meant for a sibling directory landed at
.claude/worktrees/<a>/.claude/worktrees/<b>, untracked content sitting on a
branch with an open PR, one `git add -A` away from being committed.

Only worktrees/ is ignored. Anything else under .claude/ stays visible so
settings, agents or skills can be tracked deliberately if that is ever wanted.

Verified the rule matches .claude/worktrees/ and not .claude/agents/, and that
`git ls-files -ci --exclude-standard` reports nothing — no tracked file is
shadowed by this.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Gerrrt
Gerrrt merged commit cc07b37 into main Aug 31, 2026
3 checks passed
@Gerrrt
Gerrrt deleted the gerrrt/ignore-claude-worktrees branch August 31, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant