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.

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.