Debugging gitignore

November 8, 2018

If you have a file being ignored by git and you try to add it, you'll get a message something like this:

The following paths are ignored by one of your .gitignore files:
web/scripts/blah.txt
Use -f if you really want to add them.

To find out what line in gitignore is causing this you can use:

$ cd web/scripts
$ git check-ignore -v blah.txt
.gitignore:183:[Ss]cripts       blah.txt

References

Tags: git gitignore