7

Iv'e added:

*.iml 

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

Magnus Bäck
  • 10,963
  • 3
  • 43
  • 58
JY2k
  • 2,819
  • 1
  • 28
  • 53

2 Answers2

26

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"
Braian Coronel
  • 20,278
  • 4
  • 43
  • 54
Dennis MP
  • 12,084
  • 10
  • 43
  • 61
0

When you added them one time, they will keep tracked!

You have to retrieve all commits till the one where you commited the .iml files.

Here is a good post on SF about reseting commits in git: How to revert Git repository to a previous commit?

Community
  • 1
  • 1
Rene M.
  • 2,549
  • 12
  • 23
  • 1
    This answer would be more useful if you linked to documentation and/or previous Stackoverflow answers to this FAQ. – Magnus Bäck Apr 01 '15 at 08:39