chore(gitignore): ignore node_modules symlinks, not only directories - #897
Merged
iamtoruk merged 1 commit intoAug 4, 2026
Merged
Conversation
The node_modules/ pattern (trailing slash) matches directories only. A node_modules SYMLINK, standard in linked worktrees that share one install, is not covered, which is how db018f7 accidentally committed one and every subsequent checkout materialized a self-referencing symlink until c642787 removed it. Dropping the slash covers files, directories and symlinks.
iamtoruk
approved these changes
Aug 4, 2026
iamtoruk
left a comment
Member
There was a problem hiding this comment.
Correct and low-risk. The slash form ignores directories only, so a node_modules symlink (linked worktrees sharing one install) slipped into git add -A; dropping the slash covers files, directories and symlinks, making that class of accident structurally impossible. Nothing named node_modules should ever be tracked, so there is no downside. Good to merge.
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.
Root-cause hardening for the incident #896 cleaned up.
node_modules/with the trailing slash ignores directories only; a node_modules SYMLINK - which is exactly what linked worktrees sharing one install carry - is not matched, so agit add -Ain such a worktree committed one in db018f7 (mine, owning that), every later checkout materialized a self-referencing symlink on disk, and #896 had to remove the tracked entry. Dropping the slash makes the pattern cover files, directories and symlinks, so this class of accident is structurally impossible regardless of who runs what in which worktree.