Why is git ignoring a file?

I was working on a project the other day and git was ignoring .sql files I was needing to check in, but I was having trouble figuring out which .gitignore file contained the offending pattern. After a little digging, I discovered another this useful command:

git check-ignore -v pathname

where pathname is the file or directory being ignored. The -v flag will make the command return the path to the .gitignore file (relative to the project root), without that flag it will return the ignore pattern, but not the containing file.

Leave a Reply

Your email address will not be published. Required fields are marked *