Debugging the .gitignore file
Kennard • June 19, 2019git
Ever had a rogue .gitignore causing problems? Here's a quick tip on how to debug something like that.
Run the following command in the root of your project directory.
git check-ignore -v path/to/some/file
The important bit here is the
This will result in the following output.
In this example the output indicates that the
.gitignore file in the root of the project
is the culprit. It contains
some/ on line 3 which causes
path/to/some/file to be ignored.
This command can especially be helpful when you have configured a global excludes file in
~/.gitconfig and just can't
figure out why a particular file is being ignored.