My repo has a big .gitignore. I also have some rules in my .git/info/exclude because I do not want my workflow to affect the repo: I use certain tools, and certain processes which generate files, that I do not want to neither be commited to the repo, nor be listed in the .gitignore. Those are my "private ignored files".
In a recent project, I have experienced a funny situation: running some tests with some excluded files present break the tests in strange ways. Therefore, before I run the tests (which take hours to run), I need to make sure that I got rid of annoying private files.
Listing all excluded files is not an option:
git ls-files --other
This produces a list too big for being of any use.
And this:
git ls-files --other --exclude-standard
Does not list files excluded via the rules of .git/info/exclude (or via .gitignore)
This does the opposite of what I want:
git ls-files -o -X .git/info/exclude
Lists all ignore files except those in .git/info/exclude
This goes in the right direction:
git ls-files -o -X .gitignore
But then I need to find all .gitignore in all folders manually (the repo is very large and has lots of .gitignore)
This is nice:
git check-ignore -v *
But is not recursive, and there is no recurse option.
I assume I could diff these two:
git ls-files -o
git ls-files -o -X .git/info/exclude
But really!? is there no better way to list the files excluded by one particular rule file?
EDIT
This is the closer I get:
find . -type f | git check-ignore -v --stdin | grep '\.git/info/exclude'
It only lists files (which I think is what git tracks anyway), and it is slow. I would expect an internal git command to be faster.