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.


This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.