不是在Git存储库中,而是在GitHub中——我如何搜索特定存储库/分支的提交消息?


当前回答

这已从GitHub删除。我使用:

$git log --all --oneline | grep "search query"

你也可以通过作者筛选:

$git log --all --oneline --author=rickhanlonii | grep "search query"

其他回答

到2017年,GitHub本身就包含了这个功能。

他们使用的示例搜索是repo:torvalds/linux merge:false加密策略

GIF图片来自https://github.com/blog/2299-search-commit-messages

你过去可以这样做,但GitHub在2013年年中的某个时候删除了这个功能。要在本地实现这一点,您可以这样做:

git log -g --grep=STRING

(如果您想搜索其他分支和悬空提交,请使用-g标志。)

-g, --walk-reflogs
    Instead of walking the commit ancestry chain, walk reflog entries from
    the most recent one to older ones.

这已从GitHub删除。我使用:

$git log --all --oneline | grep "search query"

你也可以通过作者筛选:

$git log --all --oneline --author=rickhanlonii | grep "search query"

在Github上使用高级搜索和其他答案的组合似乎是最简单的。它基本上是一个搜索字符串构建器。 https://github.com/search/advanced

例如,我想找到Autodesk/maya-usd中包含“USD”的所有提交

然后在搜索结果中可以从左边的列表中选择commit:

截至2019年年中

在左上方的搜索框中输入您的查询 回车 点击“提交”

截图: