如何从 git grep 搜索中排除某些目录/文件 [英] How to exclude certain directories/files from git grep search
问题描述
在使用 git grep
搜索 git 存储库时,有没有办法排除某些路径/目录/文件?类似于普通 grep
命令中的 --exclude
选项?
Is there a way to exclude certain paths/directories/files when searching a git repository using git grep
? Something similar to the --exclude
option in the normal grep
command?
我需要使用 git grep
因为在大型 git 存储库上直接使用 grep
运行速度太慢.
I need to use git grep
because using grep
directly runs too slowly on large git repositories.
推荐答案
这是不可能的,但是 最近讨论过.链接中建议的解决方法:
It's not possible, but has been discussed recently. Proposed workaround in link:
你可以把*.dll
放到.gitignore 文件然后git grep --exclude-standard
.
You can put
*.dll
to .gitignore file thengit grep --exclude-standard
.
编辑请参阅onlynone 的答案,因为 git 1.9.0 是可能的.
EDIT see onlynone's answer, since git 1.9.0 it's possible.
这篇关于如何从 git grep 搜索中排除某些目录/文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!