chore: ignore .claude/worktrees/ - #199
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Nothing under
.claude/is tracked, but it wasn't ignored either — so the worktrees under.claude/worktrees/show as untracked directories ingit statuson main, each one a full second copy of the repository:Why it's worth a rule rather than tolerating the noise
git worktree addwith 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, onegit add -Afrom 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 -vmatches.claude/worktrees/fake-checkout/file.txt→.gitignore:72.claude/agents/some-agent.md→ not ignored, stays visiblegit ls-files -ci --exclude-standardis empty — no tracked file is shadowedmake validatepasses🤖 Generated with Claude Code