When we make changes to the .gitignore file, those changes will not take effect just by updating the .gitignore file content. Git will still be tracking files according to previous content of gitignore file.
To make it work we have to clear the git cache. Here are the steps that we can follow to successfully telling git to track right files.
- Make changes in .gitignore file.
- Run git rm -r --cached . command.
- Run git add . command
Now Run the command git status
to check whether new changes in gitignore are working or not.