【问题标题】:How to search in git commit comments?如何在 git commit 评论中搜索?
【发布时间】:2017-05-30 01:24:23
【问题描述】:

我正在使用 git 并尝试在主分支中查找有关功能分支的信息。如何在 git commit cmets 中搜索字符串?

【问题讨论】:

    标签: windows git command-line


    【解决方案1】:

    git git log --grep:

    git log --all -i -E --grep="some.?regexp.?pattern"
    

    【讨论】:

    • 你有那个样本吗? fe 单词 unit 在 cmets 但不显示: git log --all -i -E -n --grep=^unit
    • 除非您“绝对确定”单词 unit 位于行首(^ 指向该方向),否则只需使用--grep=unit。跨度>
    • 顺便说一句,从答案的选项中删除了 -n 。这可以在使用 git grep 时显示文件的行号,在这种情况下是不正确的。
    • 我在 git 的 repo 上试过这个,效果很好:git log -E -i --grep="BISECT"
    猜你喜欢
    • 2011-01-08
    • 2017-02-13
    • 1970-01-01
    • 2011-11-09
    • 1970-01-01
    • 2015-11-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多