node.jsgitnpmvisual-studio-code

Removing untracked files


I am trying to remove node_modules untracked files from git status list, but to keep them in local repository.

Using:

I have tried running
git rm -r --cached node_modules
but I get error fatal: pathspec 'node_modules' did not match any files

git status returns:

On branch master
Untracked files:
(use "git add ..." to include in what will be committed)

   node_modules/

nothing added to commit but untracked files present (use "git add" to track)

EDIT:

Issue is resolved. For reference, gitignore I'm using: https://www.gitignore.io/api/visualstudiocode,visualstudio,node,windows,bower


Solution

  • Just add a hidden file .gitignore to your root folder and add node_modules to that file