Skip to content

Add Nx cache directories to Node.gitignore - #4916

Open
unrevised6419 wants to merge 4 commits into
github:mainfrom
unrevised6419:node-ignore-nx
Open

unrevised6419 wants to merge 4 commits into
github:mainfrom
unrevised6419:node-ignore-nx

Conversation

@unrevised6419

@unrevised6419 unrevised6419 commented Sep 21, 2026 •

Copy link
Copy Markdown

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 set cacheDirectory / NX_CACHE_DIRECTORY still write here.
  • .nx/workspace-data: project graph cache and other workspace data used by the Nx daemon.
  • .nx/migrate-runs: state written by nx migrate runs.

The whole .nx directory is intentionally not ignored, because .nx/installation (created by the Nx wrapper via nx init) is meant to be committed. These are the same entries Nx writes to .gitignore when it creates a new workspace.

Earlier attempts #4191 and #4244 were closed automatically for inactivity, not rejected.

Links to documentation supporting these rule changes

Merge and Approval Steps

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@unrevised6419
unrevised6419 requested a review from a team as a code owner September 21, 2026 13:22
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@unrevised6419 unrevised6419 changed the title Add Nx cache and workspace data directories to Node.gitignore Add Nx and Turborepo cache directories to Node.gitignore Sep 21, 2026
wirecat
wirecat previously approved these changes Nov 7, 2026

@wirecat wirecat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing!

@wirecat

wirecat commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

@unrevised6419 there are merge conflicts. Could you please resolve them?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 .turbo rule for Turborepo-generated data.
  • Targets specific Nx-generated directories instead of ignoring .nx entirely.
File Description
Node.gitignore Adds targeted ignore patterns for Nx-generated cache and workspace state.

Review effort: Lite (auto)

@unrevised6419 unrevised6419 changed the title Add Nx and Turborepo cache directories to Node.gitignore Add Nx cache directories to Node.gitignore Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants