How do you check why a file is not in the git status?
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
the 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 be able to find the exact file and the exact rule with a line number that is blocking your file. Try it out yourself and see if it completes your job.
Originally Posted On: Laravel News