If you’re a Git user, you’ll be familiar with the git log command, which allows you to view the commit history for a repository. This blog post is to share an extra tip while using the command, utilising the --author
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"
Hit ‘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.
Hope this random tip is a good one! Feel free to check out my other Git tips by clicking the tag below.