Filter Git commits by author

Use git log author and committer filters, choose literal or regex matching, and count commits within an explicit revision scope.

Best practices
Engineering troubleshooting and monitoring illustration

Use git log --author="pattern" to filter commits by the recorded author identity. By default the pattern is a regular expression and matching is case-sensitive. It searches the commits reachable from the selected revisions, or from HEAD when no revision is given.

Filter by name or email

git log --author="John Doe"
git log --fixed-strings --author="john@example.com"

--fixed-strings treats punctuation literally. Without it, a dot in an email pattern has regular-expression meaning. A substring match is not necessarily an exact identity match; for a stricter email match, use an anchored regular expression appropriate to the author header:

git log --author='<john@example\.com>$'

These fields are commit metadata, not proof of the human who performed an action. An author can also use different names or addresses over time.

Combine filters and output formats

# One line per matching commit.
git log --author="John" --oneline

# Include file-change statistics.
git log --author="John" --stat

# Limit by recent commit timestamps.
git log --author="John" --since="2 weeks ago"

# Count matching commits reachable from HEAD.
git rev-list --count --author="John" HEAD

Date filtering is based on commit timestamps used by revision traversal, not simply on the author's displayed date. Rewritten commits can therefore appear in a recent range even when their authorship is older. --since-as-filter can be useful when you need to inspect the whole selected history without the early traversal cutoff of --since.

Count contributors in a defined history

git shortlog -sn HEAD
git shortlog -sne --all

-s shows counts, -n sorts by count, and -e includes email addresses. --all expands the revision scope to refs available in this repository; it does not fetch missing remote history. Specify HEAD for the current branch's reachable history instead.

Shortlog supports mailmap-based identity normalization. Commit counts measure recorded commits within the chosen scope, not effort or code quality, and merges or rewritten history can affect interpretation.

FAQ

How do I ignore case? Add -i, for example git log -i --author="john".

How do I include several authors? Repeat the option: git log --author="John" --author="Jane". The author patterns are alternatives. Extended regex is another option: git log --extended-regexp --author="John|Jane".

How do author and committer differ? The author identifies the original authorship recorded in the commit; the committer records who created that commit object. Cherry-pick and rebase commonly preserve authorship while changing committer metadata. Use --committer to filter the latter.

References

Get a tailored plan

Contact us

Join the community

Scan with WeChat
to join the community

Try Guance

Start online and pay only for what you use.

Get started

Choose a Guance plan

Code hosting