取消排除特定文件夹

时间:2017-08-09 23:34:08

标签: git

除了/vendor/*之外,我希望忽略/vendor/magento/module-page-cache/

基于这个问题:.gitignore exclude folder but include specific subfolder

我想出了gitignore

/vendor/*
!/vendor/magento/
/vendor/magento/*
!/vendor/magento/module-page-cache/

当我执行git status时,它只跟踪/vendor/magento/,但内部没有任何内容。

我哪里出错了?

1 个答案:

答案 0 :(得分:0)

git status命令允许3种模式,默认模式不显示非跟踪目录中的文件。

来自git-status doc

  

<强> -u并[d模式&gt;]

     

<强> - 未跟踪-文件[=&LT;模式&gt;]

     

显示未跟踪的文件。

     

mode参数用于指定未跟踪文件的处理。它是可选的:它默认为all,如果指定,则必须   坚持选项(例如-uno,但不是-u no)。

     

可能的选择是:

     

- 不显示未跟踪的文件。

     

正常 - 显示未跟踪的文件和目录。

     

全部 - 还会在未跟踪的目录中显示单个文件。

默认情况下,git status处于normal模式。

您可以使用git status --untracked-files=allgit status -uall

相关问题