GIT: filter log by group of authors

随声附和 提交于 2019-12-06 06:02:01

EDIT: This should show commits with author names that do not contain "John" "Paul" or "Ringo". Requires git to be built with PCRE.

git log --perl-regexp --author='^(?!(.*(John|Paul|Ringo)))'

I'll leave previous variants below as they still may be of some use:


You should be able to do it using negative look-behind assertion, if your git is compiled with PCRE support. Something like this should do what you want:

git log --perl-regexp --author='(?<!(john|paul|ringo))@'

Note that the regex is actually looking for @ not preceded by john|paul|ringo. Getting this to work with names will be tricker as there may not be a convenient way to find an 'anchor' that's not preceded by the name you want to exclude.

You can try anchoring off beginning of the author line and show only commits that do not start with John|Paul|Ringo (i.e commits with John as the middle name would still be shown):

git log --perl-regexp --author='^(?!(John|Paul|Ringo))'

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!