tags:

views:

79

answers:

2

I would like to stop Git from showing ignored files in git status, because having tons of Documentation and config files in the list of Changed but not updated files, renders the list half-useless.

Can anyone tell me, if it is normal behavior for Git to show these files? I put the ignore information in a .gitignore file in the root directory of the Git repository and they are not added when using git add . but it seems that they are not fully ignored either, as they show up in the aforementioned list and do not show up in the list printed by git ls-files --others -i --exclude-standard. Only files matched by the patterns in ~/.gitignore show up there.

Could it be because at an earlier stage I didn't ignore them and they were thus committed at least once?

Thanks!

A: 

From man git-lsfiles:

-i, --ignored
Show ignored files in the output. Note that this also reverses any exclude list present.

Personally I tend to keep doxygen files in my source tree, so I simply added this to my .gitignore (which is in the topmost directory of my source tree):

docs/*

Hope that helps.

BastiBense
+5  A: 

As I found in this post, .gitignore only works for untracked files. If you added files to repository, you can:

git update-index --assume-unchanged <file>

or remove them from repository by

git rm --cached <file>

Edit

This article explains that too

MBO
`git update-index --assume-unchanged <file>` didn’t work (had tried that), but `git rm --cached <file>` did the job. Thanks!
knuton