简体   繁体   中英

Ignoring file in Git

We have a java repository which is handled through IntelliJ IDE. We have added a .gitignore file to the root of the repo, containing the following lines among other ones:

.iml
*/*iml

However, after cloning the repo and opening it with IntelliJ, it generates a new file my.project.package.iml which is not ignored by Git, it considers it as an untracked file.

I've also tried to ignore it through git update-index --assume-unchanged my.project.package.iml , but it doesn't take any effect. I've tried removing the file and regenerating it after applying this command, with no effect either.

Could someone explain my what's happening here?

EDIT

It seems that the issue with .gitignore file was that you should put *.iml instead of just .iml . But what happens with git update-index --assume-unchanged command? Why is it not taking any effect? I'm really curious about that...

Try to change .gitignore file as the following:

*.iml */*iml

eg add asterisk to the first row.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM