When I use git log , how can I filter commits so that I can see commits only from a given user?

    2 answers 2

    I’ll expand on the @katso answer :

    First, the --author parameter takes a regular expression and checks for its occurrence in the author's name string. Those. If we have developers Ivan Petrov, Semen Ivanov and Gennady Livanov, then:

     git log --author="Иван" 

    show us the commits whose authors are the first two. L ivan ov does not fit case sensitive. That's how:

     git log --author="Иван " 

    only Ivan will be found, but not Ivanov.

    Secondly, each commit has two "authors". There is a valid author of the changes made (author), but there is a person who saved these changes to the committer. This is usually the same person, but the committer will be different, for example, when you rebuild someone else's commits, or when you accept a patch by mail (and your name is Linus). You can search for commits by the second:

     git log --committer="Иван" 

    Thirdly, if you need commits of several authors, you do not need to build a complex regular program. Specify several parameters in a row. The same works with --committer .

     git log --author="Иван" --author="Геннадий" 

    Fourth, the name of the author includes both user.name and user.email . If you need an exact match, it is easier to search by email:

     git log --author="i.petrov@mycompany.com" 
       git log --author="Jon" 

      log help