If you’re a Git user, you’re likely familiar with the git log command, which allows you to view the commit history for a repository. This blog post is an extra tip on the
git log command, showing the
--author option parameter which allows you to filter the commits displayed by the author’s name.
This can be particularly useful if you are working on a large project with multiple contributors and want to see only the commits made by a specific person.
Show Commits by Author in Git
To use the –author option, simply pass the name of the author as an argument when running the git log command.
For example, if you only want to see the commits made by “pete”, you would run the following command:
git log --author="pete"
q‘ to exit out of the git log return feed.
We can also use the git one-line parameter while searching commits for an author, with a wildcard:
git log --author="Sukki*" --oneline
This will display a list of commits, each on a single line, with the author, commit message, and SHA hash of the commit.
git log command has options that allow you to tailor the information it displays. For example, you can use the –oneline parameter, which I covered in another blog post (including git log formatting).