Search code examples
gitgitignore

How to ignore .gitignore files in git status?


When I run git status, it lists a bunch of .gitignore files that I am not interested in seeing in the list (they got updated locally by Eclipse). I browsed numerous posts in regards to this seemingly common issue but none of the suggested solutions worked for me.

E.g. I went into ~/.gitconfig and found that

excludesfile = ~/.gitignore_global

Then I went into that file and added .gitignore at the tail but that did not change anything.

How do I effectively ignore .gitignore files in git status so they don't clutter the view?


Solution

  • It sounds like you might be misunderstanding what "ignore" means to Git. A file name mentioned in .gitignore means that if a file is untracked, then git status will not show that file as an untracked file.

    Ignoring a file does not do anything when the file is tracked by Git, and has been modified. That is considered a change to your repository, which Git doesn't let you ignore. (After all, you have already told Git that file is important enough to store in your repository, so Git has an obligation to inform you about changes to that file.)

    If your tools (Eclipse) is modifying your .gitignore files, I would suggest you instruct Eclipse to stop doing that.