Search code examples
gitgithubgitignore

How can I ignore subfiles in .gitignore?


I have a lot of subfolders and files like node_modules>yargs-parser>README.md. And I wrote node_modules in .gitignore file but when I change something in a file like README.md, git is not ignoring the changes. How can I ignore?


Solution

  • If the file you are trying to ignore is already on the index, you need to remove it first with git rm --cached <file> then you can ignore it in .gitignore