【发布时间】:2018-08-04 20:43:47
【问题描述】:
我只想查看文本中包含特定单词的不同文件。
current_directory$ git grep 'word'
显示文件中具有匹配单词的每一行。
所以我尝试了这个
current_directory$ git grep 'word' -- files-with-matches
current_directory$ git grep 'word' -- name-only
但它没有显示任何输出。
另外,我如何计算所有文件中“单词”的总出现次数?
【问题讨论】:
-
它是
--files-with-matches。--后面没有空格。 -
@Ryan current_directory$ git grep 'word' --files-with-matches fatal: bad flag '--files-with-matches' used after filename
-
哦,您还必须将选项放在非选项之前。
git grep --files-with-matches 'word'