1

Here is the content of my .gitignore file

# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

#Eclipse/Intellij
.classpath
.project
.settings/
target/
*.iml
.idea/

Basically all I want is to ignore the directory .idea and all the content in it. However, there is always one file that keeps popping up. I don't know why.

civilization/.idea/workspace.xml

This file keeps coming all the time, and I don't know why it doesnt get ignored!

2
  • 3
    because you already added it to the index? Commented Sep 12, 2014 at 18:56
  • 1
    or even commited it? Commented Sep 12, 2014 at 19:00

1 Answer 1

2

.gitignoreonly works for new files. If the file is already tracked you need to tell git not to do so any longer:

git rm .idea --cached

If you are not sure if files which are expected to be ignored are tracked or not, just remove all the files from the index and then add them back - git will use .gitignore when the files are being put back in the index.

git rm -r . --cached
git add .
Sign up to request clarification or add additional context in comments.

3 Comments

Aaaah! Yes that indeed is the problem. I would thing it was smart enough to understand it should ignore it. Oh well. Now at least I know
After running rm git they are marked as deleted and git wants me to commit it. Guess thats fine...
@Shervin - Yes that's fine. Be sure to add --cached option, otherwise it will remove files from your working copy as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.