什么!* /意思是.gitignore [英] What does !*/ mean in .gitignore
问题描述
我发现的工作解决方案依赖于命令<$ c
$ b
#忽略所有
*
#除了这些文件
!.gitignore
!* /
!*。php
如果没有!* /
,它将只包含 *。php
文件根目录。什么是!* /
这样做是否允许这样做?
可选的前缀!否定了这种模式;任何匹配文件
将被重新包括在内。如果该文件的父目录不包含
,则重新包含文件不是
。 Git没有列出性能为
原因的排除目录,所以包含文件上的任何模式都不起作用,不管
在哪里定义。在第一个
!!前加一个反斜杠(\)对于以文字!开头的模式,例如
!important!.txt。
With git version 1.7.1, I'm trying to exclude all files except .php files.
The working solution I found relies on the command !*/
# Ignore Everything
*
# Except these files
!.gitignore
!*/
!*.php
Without the !*/
, it will only include the *.php
files in the root directory. What is !*/
doing that allows this to work?
Take a look at the documentation of gitignore
An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined. Put a backslash ("\") in front of the first "!" for patterns that begin with a literal "!", for example, "!important!.txt".
这篇关于什么!* /意思是.gitignore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!