Tree view sometimes follows .gitignore and sometimes doesn't


#1

So basically, I have a root file with a two subfolders. In the root of the file itself, I have a .gitignore file mainly to ignore *.in and *.out files when updating my git repository. Now in subfolder A, the first one created, the tree view ignore any .out or .in files and doesn’t show them which is what I expect. But, when I created subfolder B and a subfolder C inside B, just the .in and .out files in subfolder C show in the tree view when I expect them not to. Recopying the the .gitignore files doesnt really work. The example file system would be as follows:

/root -> .gitignore file is here
/root/A -> .in files here do not show in tree view
/root/B
/root/B/C -> .in files here do show in tree view

Is there something wrong with my understanding of the situation, something I am not doing right, or something I can do to resolve the issue and have the .gitignore universally applied to any files inside my root folder? Also, I am working on OS X, 10.11.6


#2

You can use the Git command git check-ignore -v [path] to check if Git is ignoring certain files and what rule in your local .gitignore is being used to ignore that path, if any. If that Git command reveals a file is being ignored and Tree View is not showing it as ignored (whether by graying it out or hiding it completely), then you have possibly found a bug. A couple caveats, that Git command does not catch files ignored by your global Git ignores, if any. So if something is not listed in the output of check-ignore but is displayed as ignored in the Tree View, it is probably ignored by your global Git ignores.

There are some bugs around Git ignores not being handled properly, but they are most often in cases much more complex than the one you describe. So I doubt that you’re running into a bug.