【发布时间】:2011-09-27 18:31:50
【问题描述】:
我要遍历所有子目录,除了“node_modules”目录。
【问题讨论】:
-
如果您在 git 存储库中查找代码并且
node_modules在您的.gitignore中,git grep "STUFF"是最简单的方法。git grep在工作树中搜索跟踪的文件,忽略.gitignore中的所有内容 -
节点示例:
grep -R --exclude-dir={node_modules,bower_components} "MyString" | cut -c1-"$COLUMNS"- 此外,您始终可以在 shell 中将其别名为 'nodegrep' 或其他任何内容,并使用命令参数作为字符串输入..