如何使用.gitignore忽略包含其所有子目录的目录,而仍然忽略其中的所有文件

时间:2018-11-28 11:49:16

标签: git gitignore

首先,我已经读过this SO Q,并且还要确保将其从标记ref to SO Q的标签中删除。

我的.gitiignore

web/node_modules/**/**/
web/node_modules/**/**
web/node_modules/**/**/**/
web/node_modules/**/**/**
web/node_modules/**/**/**/**/
web/node_modules/**/**/**/**
build/web/node_modules/.bin
build/web/node_modules
build/web/node_modules/**

我目前的方法仍然存在这个问题:

#   new file:   node_modules/buffer-from/LICENSE
#   new file:   node_modules/chai/CODEOWNERS
#   new file:   node_modules/chai/LICENSE
#   new file:   node_modules/check-error/LICENSE
#   new file:   node_modules/core-util-is/LICENSE
#   new file:   node_modules/debug/Makefile
#   new file:   node_modules/deep-eql/LICENSE
#   new file:   node_modules/es6-promise/LICENSE
#   new file:   node_modules/escape-string-regexp/license
#   new file:   node_modules/extract-zip/LICENSE
#   new file:   node_modules/extract-zip/node_modules/debug/Makefile
#   new file:   node_modules/fd-slicer/LICENSE
#   new file:   node_modules/get-func-name/LICENSE
#   new file:   node_modules/glob/LICENSE
#   new file:   node_modules/has-flag/license
#   new file:   node_modules/he/bin/he
#   new file:   node_modules/inherits/LICENSE
#   new file:   node_modules/isarray/Makefile
#   new file:   node_modules/mkdirp/LICENSE
#   new file:   node_modules/mocha/LICENSE
#   new file:   node_modules/mocha/bin/_mocha
#   new file:   node_modules/mocha/bin/mocha
#   new file:   node_modules/once/LICENSE
#   new file:   node_modules/path-is-absolute/license
#   new file:   node_modules/progress/Makefile
#   new file:   node_modules/puppeteer/LICENSE
#   new file:   node_modules/readable-stream/LICENSE
#   new file:   node_modules/safe-buffer/LICENSE
#   new file:   node_modules/string_decoder/LICENSE
#   new file:   node_modules/supports-color/license
#   new file:   node_modules/type-detect/LICENSE
#   new file:   node_modules/typedarray/LICENSE
#   new file:   node_modules/wrappy/LICENSE
#   new file:   node_modules/ws/LICENSE
#   new file:   node_modules/yauzl/LICENSE

第二,我怀疑我的某些.gitignore无法正常工作,或者我对此有误解。

0 个答案:

没有答案