gitignore - 只允许某些扩展名和文件 [英] gitignore - only allow certain extensions and files
问题描述
不知道为什么这不起作用,因为我已经完成了这个加载!也许我的日子不好过......
我使用下面的代码忽略除某些文件名和扩展名以外的所有文件
*
!.gitattributes
!.gitignore
!readme.md
!.gitkeep
!*。php
出于某种原因,它只允许我提交.gitignore和自述文件。 MD,即使我有PHP文件在子文件夹等。有什么不对吗?只是fyi,我使用git add -A来提取要提交的文件。
预先感谢!
<$ p
p> *
!.gitattributes
!.gitignore
!readme.md
!.gitkeep
!*。php
!* /
否则,只有 *。php
第一个目录级别的文件将被接受,所有子目录将被忽略。
not sure why this isn't working, as I've done this loads! Maybe I'm having a bad day...
I'm using the following code to ignore all files except for certain filenames and extension
*
!.gitattributes
!.gitignore
!readme.md
!.gitkeep
!*.php
For some reason, its only allowing me to commit the .gitignore and readme.md, even though I have php files in subfolders etc. Is there anything wrong with it? Just fyi, I'm using "git add -A" to pick up the files to commit.
Thanks in advance!
The solution is to tell Git not to ignore sub directories:
*
!.gitattributes
!.gitignore
!readme.md
!.gitkeep
!*.php
!*/
Otherwise, only the *.php
files in the first directory level will be accepted and all sub directories will be ignored.
这篇关于gitignore - 只允许某些扩展名和文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!