git grep : Sometimes empty result even when the word exists in a file

标签 git ubuntu grep response

我之前一直在找这个,但找不到了。 使用:Ubuntu 11.10 64 位

我想找一个以前制作的源文件,但是没找到。 所以我用 git grep 找到了它:

git rev-list --all | (
    while read revision; do
        git grep -F 'leaderboard' $revision
    done
)

但结果是一个空响应!这真的很奇怪,因为“排行榜”实际上在存储库中,它在当前版本中,但也在旧版本中(在 XML 文件中):

<query name="leaderboard.getById">

其他搜索会给出结果,例如消息或其他内容。

最佳答案

您的语法导致 shell 中的重定向不明确。这应该适合你:

git grep -F 'leaderboard' $(git rev-list --all)

关于git grep : Sometimes empty result even when the word exists in a file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10180988/

相关文章:

git - git subtree merge 和 git-subtree 有什么区别

git - git 分支的永久链接

c - 在哪里可以找到 libvlc 以将其包含在 Ubuntu 上?

linux - 为什么 "grep -w"匹配以 "."或 "$"结尾的字符串?

unix - 如何在 Unix 中查找包含特定文本的最新文件?

Git:无法从一台计算机推送

git - 我在远程删除了一个分支,如何在本地同步?

bash - 如何在 atom 终端中使用 conda 而不输入 source ~/.bashrc?

java - 从 php 执行 jar 文件时无法连接到 X11 服务器

regex - bash:使用正则表达式 grep 段落