Git日志显示作者或提交消息的提交 [英] Git log to show commits either by author OR commit message
问题描述
我想使用git log(接受其他建议)列出所有提交的内容
I would like to use git log (open to other suggestions) to list all commits that either
- 由特定作者完成
或
- 在提交消息中有一个特定的单词
我知道如何分别搜索每个,但是我想要一个包含所有匹配提交的列表.最简单的方法是什么?
I know how to search for each separately, but I would like a single list containing all matching commits. What is the easiest way to achieve this?
推荐答案
您可以使用 git rev-list
生成 git log
应该显示的哈希ID,以及然后使用 git log --no-walk --stdin
读取这些ID,并根据通常的 git log
排序标准对其进行排序,并显示它们.(注意:这有时会更改您在 git log
without -no-walk
中看到的输出顺序.)
You can use git rev-list
to generate the hash IDs that git log
should show, and then use git log --no-walk --stdin
to read those IDs, sort them according to the usual git log
sorting criteria, and show them. (Note: This will occasionally change the output order from what you would see with git log
without --no-walk
.)
例如:
(git rev-list --author 'A. U. Thor' HEAD;
git rev-list --grep 'pattern' HEAD) |
git log --no-walk --stdin
(出于发布目的,分为三行;某些命令行解释器在实际使用时会要求该命令为一行).
(split into three lines for posting purposes; some command line interpreters will require that the command be a single line when actually used).
这篇关于Git日志显示作者或提交消息的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!