How to check why a file is not showing up in git status?

Written by Mandeep Singh in Solving Mistories

If you are working on someone else's code or working in a team, it is quite possible that at some point you add a new file to git, but it just won't show up on git status. You won't be able to stage or add it. This generally happens because of one of the rules in some .gitignore file is blocking that file.

In most cases, you have a single .gitignore file in your project root and you can easily find the issue and correct it but if the project is big or you are using a framework, or you forgot about global .gitignore, it is going to be hard to find the real culprit unless you know this command:

git check-ignore -v path/to/ignored/file

By using this command, you will not only be able to find the exact file but the exact rule with a line number that is blocking your file. Try it out yourself and see if it gets the job done for you.

Sign up below to receive updates, tips and more handy tutorials when git screws up. It’s good stuff & I don’t spam.