I want to use gitk to view all commits except those by a given author. Something like the following:
开发者_如何学Pythongitk --author=!joe
Is this possible?
From the command line:
gitk --perl-regexp --author='^(?!joe)'
To exclude commits by several authors:
gitk --perl-regexp --author='^(?!jack|jill)'
Explanation: (?!whatever)
is a (perl-style) look-ahead regular expression: it matches a position not followed by whatever
. 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 running
git config --global grep.patternType perl
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])
精彩评论