Recently I was having issues in a repository where files that were not supposed to be ignored, were being ignored. I stumbled upon Git’s
check-ignore command, which will output the pattern in the
.gitignore file a specific file matches.
For this example, I’m running the command in a basic Laravel application.
git check-ignore .env
Which will result in this output:
If you want to see a little bit more, you can add
-v to get the line number the pattern is on in the
git check-ignore .env -v