Remove node_modules from Git repository

Posted on Saturday, 15 June 2019

Run this command to remove node_modules files from your local repository

git rm -r --cached node_modules

You can also run this command to add node_modules to your .gitignore

echo "/node_modules" >> .gitignore

Source: Stackoverflow - Ignore node_modules folder everywhere