Find all Git commits from authors whose email is not in certain domain (ex.


I’m pushing a large repo into another on Azure DevOps Repos and I’m getting error because one repo policy only allows author with pattern for email.

The push was rejected because one or more commits contain author email ‘[email protected]’ which does not match the policy-specified patterns

When I run the git command below on my window PC I can see the precise check-in from this [email protected]

git log --name-only --author="[email protected]"

How can I run the git log command to find all commits that are not is there a built in command in git?

My un-successful attempts so far using regex:

git log --name-only --author='@(?!abc\.com)([^.]+\.)+com$' --perl-regexp

git log --name-only --author='^((?!*)abc\.com)$' --perl-regexp


git log --all --pretty="%h %aE %cE" will list all author and committer emails for your commits.

You can then process the output however you see fit.

AFAIK there isn’t a built-in command to list "the commits whose author do not match that domain".

Answered By – LeGEC

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published