How to Find the ".gitignore" Rule That's Causing a File to Be Ignored?

You can use the following code to verify and debug which pattern in the .gitignore file is causing a particular file to be ignored:

# git 1.8.2+
git check-ignore -v path/to/file

Note that it is possible to pass multiple file names to git check-ignore.

Hope you found this post useful. It was published . Please show your love and support by sharing this post.