gitk 可以显示除给定作者之外的所有提交吗?
我想使用 gitk 查看除给定作者之外的所有提交。类似于以下内容:
gitk --author=!joe
这可能吗?
I want to use gitk to view all commits except those by a given author. Something like the following:
gitk --author=!joe
Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从命令行:
要排除多个作者的提交:
说明:
(?!whatever)
是一个(perl 样式)前瞻正则表达式:它匹配后面没有whatever 的位置
。我们通过“字符串开头”正则表达式^
将其锚定到 Author 字段的开头。或者运行 gitk --perl-regexp ,然后在 gitk 菜单中选择 View ->新视图(或简称 Shift+F4)并将
^(?!joe)
写入“作者”字段。如果您不想总是输入 gitk --perl-regexp,您可以通过运行
git config --global grep.patternType perl< 将 git 设置为全局使用 perl 正则表达式/代码>
From the command line:
To exclude commits by several authors:
Explanation:
(?!whatever)
is a (perl-style) look-ahead regular expression: it matches a position not followed bywhatever
. We anchor it to the beginning of the Author field by the "beginning of string" regexp^
.Or run
gitk --perl-regexp
and then in the gitk menu, select View -> New View (or Shift+F4 for short) and write^(?!joe)
into the "Author" field.If you do not want to always have to type
gitk --perl-regexp
, you can set up git to globally use perl regular expressions by runninggit config --global grep.patternType perl
我认为没有一个非常简单的方法可以做到这一点 -
如果您有 perl 或类似的东西,您可以拼凑出一个解决方案:
获取您想要排除的提交列表并将它们放入哈希中: git rev-list [refs] --author="[作者模式]"
获取列表您想要显示的提交: git rev-list [refs]
从您想要显示的提交中减去哈希中的项目
显示您确实想要显示的提交:gitk --no-walk [减法的输出]
你可以很容易地在 perl/python/ruby 中编写一些东西来执行 1-3,然后只需执行
gitk --no-walk $(drop-author.pl [refs] [author -图案])
I don't think there is a terribly easy way to do it--
If you have perl or something similar, you can piece together a solution:
Get the list of commits you want to exclude and put them in a hash: git rev-list [refs] --author="[author pattern]"
Get the list of commits you want to show: git rev-list [refs]
Subtract the items in the hash from the commits you want to show
Show the commits you do want to show: gitk --no-walk [output of subtraction]
You could write something in perl/python/ruby pretty easily to do 1-3, and then just do
gitk --no-walk $(drop-author.pl [refs] [author-pattern])