我如何强制 ag 在 node_modules 中找到匹配项?
How can I force ag to find matches in node_modules?
我正在使用 ag 搜索 git 存储库。它在我的 node_modules
子目录下找不到匹配项。为什么不,我该如何控制这种行为?
事实证明,默认情况下 ag 遵循 .gitignore
文件的内容。因此,如果 node_modules
在 .gitignore
中,ag 将不会搜索它。这都是明智的行为,但如果您不期望它,则很难调试。希望这篇 post 能有所帮助。
man ag
结尾有一个很好的总结:
IGNORING FILES
By default, ag will ignore files whose names match patterns in .gitig-
nore, .hgignore, or .agignore. These files can be anywhere in the
directories being searched. Ag also ignores files matched by the
svn:ignore property if svn --version is 1.6 or older. Finally, ag looks
in $HOME/.agignore for ignore patterns. Binary files are ignored by
default as well.
If you want to ignore .gitignore, .hgignore, and svn:ignore, but still
take .agignore into account, use -U.
Use the -t option to search all text files; -a to search all files; and
-u to search all, including hidden files.
就我的目的而言,ag -t
似乎效果不错。
我正在使用 ag 搜索 git 存储库。它在我的 node_modules
子目录下找不到匹配项。为什么不,我该如何控制这种行为?
事实证明,默认情况下 ag 遵循 .gitignore
文件的内容。因此,如果 node_modules
在 .gitignore
中,ag 将不会搜索它。这都是明智的行为,但如果您不期望它,则很难调试。希望这篇 post 能有所帮助。
man ag
结尾有一个很好的总结:
IGNORING FILES
By default, ag will ignore files whose names match patterns in .gitig-
nore, .hgignore, or .agignore. These files can be anywhere in the
directories being searched. Ag also ignores files matched by the
svn:ignore property if svn --version is 1.6 or older. Finally, ag looks
in $HOME/.agignore for ignore patterns. Binary files are ignored by
default as well.
If you want to ignore .gitignore, .hgignore, and svn:ignore, but still
take .agignore into account, use -U.
Use the -t option to search all text files; -a to search all files; and
-u to search all, including hidden files.
就我的目的而言,ag -t
似乎效果不错。