Instead of creating a new .gitignore
file, you should use the .git/info/exclude
file to setup ignore rules specific to your clone of the repo.
So, basically, go to your project root, and run
cd $PROJECT_ROOT
echo "*.iml" >> .git/info/exclude
Note that the the pattern *.iml
will take care of files of kind .*.iml
as well, so you can make do with one ignore rule.
Also, this complements the existing ignore rules in .gitignore
and ignore rules of .gitignore
will still be applied.
It seems you are already tracking the .iml
files in your Git repo, so you can try removing them from Git using
git rm -r *.iml
git commit -m "removed *.iml"
Note that this will untrack them from the master repository as well once you do a push.
Otherwise, you can use git update-index --assume-unchanged <filename>
to ignore changes to those files locally.
And afterwards, the gitignore rules should work all right.