2017-09-01 126 views
0

在我的.gitignore我也行:gitignore包括特定的路径

/storage/*.key 

但我不想忽略这个特定的路径和它的所有内容:

/storage/app/public/* 

现在,内这条道路还有另一种.gitinore文件,它具有:

* 
!.gitignore 

而且在相同的路径还有另一个具有的.gitignore:

* 
!public/ 
!.gitignore 

我认为这将是添加路径,但不工作。

那是什么?如何做到我想要的(添加存储/应用程序/公共*的路径)?

回答

0

只需点击它的确切的.gitignore和精确的规则无视公众:

cd /path/to/my/repo 
# from the root folder of the repo: 
git check-ignore -v /storage/app/public/aFileWithinPublic 

你需要测试的文件,因为文件夹不被Git的跟踪。

规则很简单:

It is not possible to re-include a file if a parent directory of that file is excluded.

因此,如果该文件夹公众被忽略(在父母的.gitignore一个“*”的规则),如果任何公开的父文件夹的是忽视,排除量不会使公开内容不被忽略。

所以这是很好的(从.gitignorestorage/app/public/文件夹的父级):

* 
!public/ 

但如果storage/app/storage/被忽略自己,这种排斥将被忽略为好。

这就是为什么git check-ignore -v /storage/app/public/aFileWithinPublic很重要:它会解释是什么原因导致文件夹内容为仍然被忽略。