Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio gitignore won't ignore .iml

Iv'e added:

*.iml 

to all of the gitignore files in my project. They are still being tracked, even after committing the .gitignore.

like image 991
JY2k Avatar asked Apr 01 '15 08:04

JY2k


People also ask

Why is my file not being ignored in Gitignore?

. gitignore only ignores files that are not part of the repository yet. If you already git add ed some files, their changes will still be tracked. To remove those files from your repository (but not from your file system) use git rm --cached on them.

Should I add .IML to Gitignore?

iml files are not really needed and can be gitignore'd. *. iml files are created by IntelliJ IDEA based on the pom. xml file read by Maven to resolve dependencies of the project.

Why is my Gitignore file not working?

Check the file you're ignoring gitignore will not ignore a file if it's already present or is part of a repository. In other words, Git can only ignore untracked files. Take a good look at your structure, and make sure you're trying to ignore the file that isn't already committed to your repository.


1 Answers

git will track the files sometimes even if you added the file which shouldn't be tracked in .gitignore

In that case you should remove the cache first then add all.

Important : Before, commit or stash your current changes

$ git rm -r --cached .
$ git add .
$ git commit -m "file tracking - changed"
like image 112
Dennis MP Avatar answered Oct 05 '22 17:10

Dennis MP