fix(core): add .claude/worktrees to gitignore#34693
Conversation
Claude Code worktrees under .claude/worktrees/ get picked up by Nx as workspace projects, causing duplicate project errors. - Add .claude/worktrees to all three gitignore templates for new workspaces - Add migration for existing workspaces (22.6.1)
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
View your CI Pipeline Execution ↗ for commit 77e52a3
☁️ Nx Cloud last updated this comment at |
| "22-6-1-add-claude-worktrees-to-git-ignore": { | ||
| "cli": "nx", | ||
| "version": "22.6.0-beta.10", | ||
| "description": "Adds .claude/worktrees to .gitignore", | ||
| "implementation": "./src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore" | ||
| }, |
There was a problem hiding this comment.
Migration version mismatch: The migration is named 22-6-1-add-claude-worktrees-to-git-ignore (suggesting version 22.6.1) but has "version": "22.6.0-beta.10". This inconsistency will cause the migration to run at the wrong time.
If users upgrade from 22.6.0-beta.10+ to 22.6.1, the migration won't run because Nx migrations only execute for versions newer than the user's current version. Users on 22.6.0-beta.10 or later will never get this migration applied.
Fix by aligning the version:
"22-6-1-add-claude-worktrees-to-git-ignore": {
"cli": "nx",
"version": "22.6.1",
"description": "Adds .claude/worktrees to .gitignore",
"implementation": "./src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore"
}| "22-6-1-add-claude-worktrees-to-git-ignore": { | |
| "cli": "nx", | |
| "version": "22.6.0-beta.10", | |
| "description": "Adds .claude/worktrees to .gitignore", | |
| "implementation": "./src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore" | |
| }, | |
| "22-6-1-add-claude-worktrees-to-git-ignore": { | |
| "cli": "nx", | |
| "version": "22.6.1", | |
| "description": "Adds .claude/worktrees to .gitignore", | |
| "implementation": "./src/migrations/update-22-6-0/add-claude-worktrees-to-git-ignore" | |
| }, |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
When Claude Code creates worktrees under
.claude/worktrees/, Nx picks them up as workspace projects. This causes duplicate project errors that break the project graph.Expected Behavior
.claude/worktreesis gitignored so worktree copies of the repo don't interfere with Nx's project detection.Changes:
.claude/worktreesto all three gitignore templates for new workspacesaddEntryToGitIgnore