xxxxxxxxxx
touch .gitignore && echo "node_modules/" >> .gitignore && git rm -r --cached node_modules ; git status
xxxxxxxxxx
If you add the below text into your .gitignore file,
then it will look for the node_modules directory. Then the node_modules
directory will be ignored.
node_modules/
xxxxxxxxxx
touch .gitignore //to create a .gitignore if you dont have one
echo "node_modules/" >> .gitignore //this adds node_modules to gitignore
cat .gitignore //checks what files you have in your gitignore
xxxxxxxxxx
create a .gitignore file grobally
On that file add the line "node_modules"
xxxxxxxxxx
// First, install the 'gitignore' module by running the following command:
// npm install gitignore
const gitignore = require('gitignore');
// Specify the desired patterns to include in the .gitignore
const patterns = [
'/node_modules',
'.env',
'*.log'
];
// Generate the .gitignore content
const content = gitignore.compile(patterns);
// Print the generated .gitignore content
console.log(content);