git log –author: Show Commits by a Specific Person
Running git log --author=Tama shows only the commits whose author is Tama. This is useful when you want to review your own commits or the work of specific team members in a shared repository. However, a partial name match also brings in commits from other people, so you need to be careful about the syntax when you want to narrow it down to exactly one person.
I tested on Ubuntu 24.04 with Git 2.43.0. All author names and email addresses are example values. I set the author and committer dates with the environment variables GIT_AUTHOR_DATE and GIT_COMMITTER_DATE. The committer for every commit is Neko <neko@example.com>. I turned off the pager. I did not test on Windows or macOS, or how to filter by author in the GitHub interface.
- 1. The history before filtering
- 2. Narrowing down to one person with –author
- 3. Partial name matches also show other people
- 4. Filtering by email address
- 5. Case matters
- 6. Showing commits from several people
- 7. Combining with message or file filters
- 8. Excluding a specific person's commits
- 9. Author and committer are different
The history before filtering
I used a repository with 7 commits written by four authors: Neko, Tama, Nekomata, and Mike. --format="%h %an <%ae> %s" is a format that lists the abbreviated hash, the author name, the author email address, and the subject (format specifiers in the official reference).
$ git log --format="%h %an <%ae> %s"
e1f0510 Neko <neko@example.com> 説明を直す
1d825b6 Mike <mike@example.com> 価格表を追加
c57f0f7 Tama <tama@example.com> ログインのエラー表示を直す
c41e7df Nekomata <nekomata@example.com> 検索を追加
38c157a Neko <neko@example.com> READMEに使い方を追加
b3c211c Tama <tama@example.com> ログイン画面を追加
ed7276a Neko <neko@example.com> 最初のコミット
Narrowing down to one person with –author
If you put a name after --author=, only that author's commits are shown. Of the 7 commits, the 2 by Tama remained.
$ git log --format="%h %an <%ae> %s" --author=Tama
c57f0f7 Tama <tama@example.com> ログインのエラー表示を直す
b3c211c Tama <tama@example.com> ログイン画面を追加
You can also use it with the default display, without --format. -1 limits the output to one commit.
$ git log --author=Tama -1
commit c57f0f7daf8d1802c9f274ada260759463e43ba5
Author: Tama <tama@example.com>
Date: Thu Nov 5 10:00:00 2026 +0900
ログインのエラー表示を直す
If you only want the count, use --oneline to print one commit per line and count the lines with wc -l.
$ git log --oneline --author=Tama | wc -l
2
Partial name matches also show other people
According to the official description of –author, the value given to --author is treated as a regular expression and matched against the author line. It does not require the whole name to match exactly. So --author=Neko also showed the commits by Nekomata, whose name contains Neko.
$ git log --format="%h %an <%ae> %s" --author=Neko
e1f0510 Neko <neko@example.com> 説明を直す
c41e7df Nekomata <nekomata@example.com> 検索を追加
38c157a Neko <neko@example.com> READMEに使い方を追加
ed7276a Neko <neko@example.com> 最初のコミット
The author line has the form Neko <neko@example.com>, with a space and < after the name. If you include the < as in --author="Neko <", Nekomata is excluded.
$ git log --format="%h %an <%ae> %s" --author="Neko <"
e1f0510 Neko <neko@example.com> 説明を直す
38c157a Neko <neko@example.com> READMEに使い方を追加
ed7276a Neko <neko@example.com> 最初のコミット
Writing the name and email address together, wrapped in the regular expression anchors ^ (start of line) and $ (end of line), also gave the same 3 commits.
$ git log --format="%h %an <%ae> %s" --author="^Neko <neko@example.com>$"
e1f0510 Neko <neko@example.com> 説明を直す
38c157a Neko <neko@example.com> READMEに使い方を追加
ed7276a Neko <neko@example.com> 最初のコミット
Filtering by email address
The author line also contains the email address, so you can filter by it. This is useful when two people share the same name, or when the name is written differently from commit to commit.
$ git log --format="%h %an <%ae> %s" --author=tama@example.com
c57f0f7 Tama <tama@example.com> ログインのエラー表示を直す
b3c211c Tama <tama@example.com> ログイン画面を追加
When you start the pattern at < before the email address, nekomata@example.com is excluded and only neko@example.com remains.
$ git log --format="%h %an <%ae> %s" --author="<neko@"
e1f0510 Neko <neko@example.com> 説明を直す
38c157a Neko <neko@example.com> READMEに使い方を追加
ed7276a Neko <neko@example.com> 最初のコミット
Case matters
--author=TAMA showed nothing. To search without regard to case, add -i (--regexp-ignore-case).
$ git log --format="%h %an <%ae> %s" --author=TAMA
$ git log --format="%h %an <%ae> %s" -i --author=TAMA
c57f0f7 Tama <tama@example.com> ログインのエラー表示を直す
b3c211c Tama <tama@example.com> ログイン画面を追加
Showing commits from several people
If you write --author twice, commits that match either value are shown (the official description of –author). The 3 commits by Tama and Mike were listed from newest to oldest.
$ git log --format="%h %an <%ae> %s" --author=Tama --author=Mike
1d825b6 Mike <mike@example.com> 価格表を追加
c57f0f7 Tama <tama@example.com> ログインのエラー表示を直す
b3c211c Tama <tama@example.com> ログイン画面を追加
You can also combine the names into one pattern with |. However, without any option, Git treats the pattern as a basic regular expression, so | does not mean "or". With -E (extended regular expressions), you get the same 3 commits as with two --author options.
$ git log --format="%h %an <%ae> %s" --author="Tama|Mike"
$ git log --format="%h %an <%ae> %s" -E --author="Tama|Mike"
1d825b6 Mike <mike@example.com> 価格表を追加
c57f0f7 Tama <tama@example.com> ログインのエラー表示を直す
b3c211c Tama <tama@example.com> ログイン画面を追加
Combining with message or file filters
When combined with --grep, which searches commit messages, only commits matching both conditions are shown. Of Tama's 2 commits, only the one whose message contains エラー (error) matched.
$ git log --format="%h %an <%ae> %s" --author=Tama --grep=エラー
c57f0f7 Tama <tama@example.com> ログインのエラー表示を直す
If you put a file path after --, only the commits by that person that changed the file are shown. In this history, all 3 of Neko's commits changed README.md.
$ git log --format="%h %an <%ae> %s" --author=Neko -- README.md
e1f0510 Neko <neko@example.com> 説明を直す
38c157a Neko <neko@example.com> READMEに使い方を追加
ed7276a Neko <neko@example.com> 最初のコミット
Excluding a specific person's commits
--invert-grep, which inverts the result of --grep, had no effect on --author. The output was the same 4 commits as with --author=Neko alone. The official description of –invert-grep also says that it only inverts the message condition given by --grep.
$ git log --format="%h %an <%ae> %s" --author=Neko --invert-grep
e1f0510 Neko <neko@example.com> 説明を直す
c41e7df Nekomata <nekomata@example.com> 検索を追加
38c157a Neko <neko@example.com> READMEに使い方を追加
ed7276a Neko <neko@example.com> 最初のコミット
To exclude a specific person, use -P (--perl-regexp) to switch to Perl-compatible regular expressions, and use the negative lookahead (?!…). ^(?!Neko <) means "the start of the line is not Neko <". The 3 commits by Neko were excluded, and Nekomata's commit remained.
$ git log --format="%h %an <%ae> %s" --perl-regexp --author="^(?!Neko <)"
1d825b6 Mike <mike@example.com> 価格表を追加
c57f0f7 Tama <tama@example.com> ログインのエラー表示を直す
c41e7df Nekomata <nekomata@example.com> 検索を追加
b3c211c Tama <tama@example.com> ログイン画面を追加
According to the official reference, whether Perl-compatible regular expressions are available depends on how Git was built. In a build without them, -P stops with an error. In the Git 2.43.0 I tested, it worked.
Author and committer are different
A commit records two people: the author and the committer. When I looked at the contents of the commit with git cat-file -p, the commit 価格表を追加 (Add price table) had Mike as the author and Neko as the committer. (In this test, every commit's committer is Neko.)
$ git cat-file -p HEAD~1
tree bfd691353167aa7d6b26f525ff3b4f8f0e7d49af
parent c57f0f7daf8d1802c9f274ada260759463e43ba5
author Mike <mike@example.com> 1793926800 +0900
committer Neko <neko@example.com> 1793926800 +0900
価格表を追加
--author only looks at the author line. To filter by committer, use --committer. --committer=Mike showed nothing, while --committer=Neko showed all 7 commits. %cn and %ce are the committer's name and email address.
$ git log --format="%h %an <%ae> %s" --author=Mike
1d825b6 Mike <mike@example.com> 価格表を追加
$ git log --format="%h %an <%ae> %s" --committer=Mike
$ git log --format="%h %cn <%ce> %s" --committer=Neko
e1f0510 Neko <neko@example.com> 説明を直す
1d825b6 Neko <neko@example.com> 価格表を追加
c57f0f7 Neko <neko@example.com> ログインのエラー表示を直す
c41e7df Neko <neko@example.com> 検索を追加
38c157a Neko <neko@example.com> READMEに使い方を追加
b3c211c Neko <neko@example.com> ログイン画面を追加
ed7276a Neko <neko@example.com> 最初のコミット
According to Viewing the Commit History in Pro Git (English edition), the author is the person who originally did the work, and the committer is the person who last applied it. When a project member applies a patch sent by someone else, the author and committer are different people. To find the changes that a person wrote, use --author. To find the commits that a person put into the repository, use --committer.




