The nature of .gitignore is that only newly added files are ignored. In the situation that a directory has been added to your repository, e.g. the mentioned .idea, then changes to these directories or file files are simply tracked by Git. To resolve the problem, you must remove this path from the git cache. The same problem applies to every other case, i.e. any directory or file.
As I mentioned above to solve the issue we must remove this path from cache. Please use the command below to do this.
git rm --cached -r .idea
If you enjoyed this post please add the comment below or share this post on your Facebook, Twitter, LinkedIn or another social media webpage.
Thanks in advanced!