git check-ignore
Use git check-ignore
command to debug your gitignore file (exclude files).
For example:
$ git check-ignore -v config.php
.gitignore:2:src config.php
The above output details about the matching pattern (if any) for each given pathname (including line).
So maybe your file extension is not ignored, but the whole directory.
The returned format is:
<source> <COLON> <linenum> <COLON> <pattern> <HT> <pathname>
Or use the following command to print your .gitignore
in user HOME and repository folder:
cat ~/.gitignore "$(git rev-parse --show-toplevel)"/.gitignore "$(git rev-parse --show-toplevel)"/.git/info/exclude
Alternatively use git add -f
which allows adding otherwise ignored files.
See: man gitignore
, man git-check-ignore
for more details.
Syntax
git check-ignore [options] pathname…?
git check-ignore [options] --stdin
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…