122 days ago · Tech · hide · Fediverse post

git log has an --author option to limit the output to commits from matching authors: $ git log --author=<pattern> But there’s no option to invert the filter and show commits from all authors except those matching a pattern. Instead, you can build the negation into the pattern itself, using a regular expression with a negative lookahead, enabled with the --perl-regexp option: $ git log --author='^((?!<pattern>).)*$' --perl-regexp A breakdown of the regular expression: ^ matches the start of the author line, which contains both the author’s name and email address. (?!<pattern>) is a negative lookahead: it fails the match if <pattern> matches at the current position, without consuming any characters. . matches any single character. The wrapping (…)* repeats the previous two steps as many times as possible, applying the lookahead at every position in the line. $ matches the end of the line. The overall effect is to match commits where the author line does not contain <pattern> at any…

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town