Repository navigation
Add Nx cache directories to Node.gitignore - #4916
Open
unrevised6419 wants to merge 4 commits into
Open
unrevised6419 wants to merge 4 commits into
unrevised6419 wants to merge 4 commits into
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 task done
wirecat
previously approved these changes
Nov 7, 2026
wirecat
left a comment
Collaborator
There was a problem hiding this comment.
Thank you for contributing!
Collaborator
|
@unrevised6419 there are merge conflicts. Could you please resolve them? |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are identified, and the change adds targeted ignore rules for generated Nx data while preserving the tracked installation directory.
No open issues 🎉
What changed in this PR
Updates Node.gitignore to exclude generated Nx cache and workspace data while preserving .nx/installation for version control.
Changes:
- Adds ignore rules for
.nx/cache,.nx/workspace-data, and.nx/migrate-runs. - Retains the existing
.turborule for Turborepo-generated data. - Targets specific Nx-generated directories instead of ignoring
.nxentirely.
| File | Description |
|---|---|
Node.gitignore |
Adds targeted ignore patterns for Nx-generated cache and workspace state. |
Review effort: Lite (auto)
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.
Link to the application or project's homepage
Reasons for making this change
Nx is most widely used monorepo build tools in the Node.js ecosystem. Both write local, machine-specific cache and runtime data into the repository that should never be committed. Each tool's own docs tell users to gitignore these paths.
Nx writes under
.nx/:.nx/cache: local task cache. Recent Nx versions default to~/.nx/<id>/cache, but older versions and workspaces that setcacheDirectory/NX_CACHE_DIRECTORYstill write here..nx/workspace-data: project graph cache and other workspace data used by the Nx daemon..nx/migrate-runs: state written bynx migrateruns.The whole
.nxdirectory is intentionally not ignored, because.nx/installation(created by the Nx wrapper vianx init) is meant to be committed. These are the same entries Nx writes to.gitignorewhen it creates a new workspace.Earlier attempts #4191 and #4244 were closed automatically for inactivity, not rejected.
Links to documentation supporting these rule changes
.nxdirectories to.gitignore": https://nx.dev/docs/kb/manual-migration.gitignoregenerated bycreate-nx-workspace: https://github.com/nrwl/nx/blob/master/packages/workspace/src/generators/new/files-package-based-repo/__dot__gitignore.nx/migrate-runsto.gitignore: https://github.com/nrwl/nx/blob/master/packages/nx/src/migrations/update-23-0-0/add-migrate-runs-to-git-ignore.tsMerge and Approval Steps
🤖 Generated with Claude Code