In some case, in the middle of our developlment, you have to add a new file or directory to the .gitignore
file.
How do you do that?
Well, first of all make sure that the changed files in your project are saved in a commit. Then, add your file or directory to your .gitignore
file.
Run these commands below to clear your repository cache and save again in a new commit:
git rm -r --cached .
git add .
git commit -m ".gitignore fix"
You will see now, in your editor (PHPStorm, Visual Studio, Sublime...) on the sidebar where are the structure of the project, the specific files that you added in the .gitignore
, the text color have been changed.
This means it worked.