Sometimes you accidentally committed .idea files (different on each computer) and you want to remove it. So here’s the command needed to remove the unwanted file from git your git’s cache:
git rm --cached -r .idea/.
That’s all. Happy playing with git!