解释哪个.gitignore规则忽略了我的文件
有没有办法看到为什么一些文件被git忽略(即.gitignore
文件中的哪个规则导致文件被忽略)?
想象一下,我有这个(或更复杂的场景,有数百个文件夹和数十个.gitignore
文件:
/-.gitignore-folder/ -.gitignore -subfolder/ -.gitignore -file.txt
如果我运行git add folder/subfolder/file.txt
git可能会抱怨它被忽略:
The following paths are ignored by one of your .gitignore files:folder/subfolder/file.txtUse -f if you really want to add them.
有没有办法知道哪一个可能.gitignore
有规则忽略这个文件,还显示规则?喜欢:
The following paths are ignored by your folder/.gitignore file (line 12: *.txt)folder/subfolder/file.txtUse -f if you really want to add them.
要不就:
$ git why-is-ignored folder/subfolder/file.txtfolder/.gitignore:12:*.txt
慕桂英4014372