8

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?

amphibient
  • 29,770
  • 54
  • 146
  • 240

5 Answers5

13

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.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
4

Try:

git status --ignored

From man git-status:

--ignored Show ignored files as well.

  • 3
    This seems to be an answer to the opposite of the problem the user is experiencing. `git status` is *showing* ignored files. He **doesn't** want to see them. – Matt Feb 10 '15 at 22:11
1

Simply add the entry '.gitignore' to the .gitignore file.Then 'git status' won't show .gitignore as one of the untracked files. This might be helpful if you don't want to include .gitignore in the source control.

shankar
  • 11
  • 1
0

You can,

Git ignore is internally used to set the ignores.

you can t ignore the ignore setting files, this woule be a strange behaviour

dzada
  • 5,344
  • 5
  • 29
  • 37
0

See if your version of git supports the untracked option. For example:

git status --untracked-files=no

Josef.B
  • 942
  • 8
  • 16