I tried adding node_modules/ to my .gitignore, but that didn't work. This is a small snippet of what I'm seeing:
$ git status On branch master Your branch is up to date with 'origin/master'.
Changes not staged for commit: (use "git add/rm ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: .gitignore modified: node_modules/.bin/acorn modified: node_modules/.bin/acorn.cmd deleted: node_modules/.bin/babylon deleted: node_modules/.bin/babylon.cmd modified: node_modules/.bin/concurrently modified: node_modules/.bin/concurrently.cmd modified: node_modules/.bin/mime modified: node_modules/.bin/mime.cmd modified: node_modules/.bin/semver modified: node_modules/.bin/semver.cmd modified: node_modules/.bin/tree-kill modified: node_modules/.bin/tree-kill.cmd deleted: node_modules/.bin/uglifyjs deleted: node_modules/.bin/uglifyjs.cmd deleted: node_modules/.bin/which deleted: node_modules/.bin/which.cmd deleted: node_modules/@types/babel-types/LICENSE deleted: node_modules/@types/babel-types/README.md deleted: node_modules/@types/babel-types/index.d.ts deleted: node_modules/@types/babel-types/package.json deleted: node_modules/@types/babylon/LICENSE deleted: node_modules/@types/babylon/README.md deleted: node_modules/@types/babylon/index.d.ts deleted: node_modules/@types/babylon/package.json
As per the output, It seems like the files under node_modules directory was already been tracked by git.
You also need to remove node_modules folder from git tracking
git rm -r --cached node_modules/
git will still show changes (deleted changes) for node_modules/ directory , as those files are now removed from git history
make a commit, from next time files under that directory will not be monitored