Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
352 views
in Technique[技术] by (71.8m points)

equivalence of: git log --exclude-author?

At work we have a git repo where the majority of all commits are automated commits by a bot user. There are times when I prefer to view a git log from that repo, but without seeing the auto commits. I guess it could be described as an inverted "git log --author" or a "git log --exclude-author=botuser", if such as option had existed.

Currently I do the following, shortcuted to a bash alias.

git log --format="%H %aE" | grep -v -F botuser@domain | while read hash email; do git log -1 $hash; echo; done | less

My question is if there is a less hackish solution to what I want to accomplish?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

From https://coderwall.com/p/tzdzwa :

git log --perl-regexp --author='^((?!excluded-author-regex).*)$'

This worked for me.

If you don't want to specify --perl-regexp every time you can do:

git config --global grep.patternType perl

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...