How to Search for Commits by Author or Message
In a hurry? Watch our brief 1-minute vertical video that summarizes the info below.
The git log command is a powerful tool for inspecting the history of a repository. But when the history is long, it can be hard to find what you're looking for.
Luckily, git log comes with a variety of options to filter the commit history!
The Git Cheat Sheet
No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free!
Searching by Commit Message
To search for commits that contain a specific word or phrase in their message, you can use the --grep flag:
$ git log --grep="fix bug"
By default, this search is case-sensitive. To make it case-insensitive, you can add the -i flag:
$ git log --grep="fix bug" -i
Searching by Author
You can also filter commits by author using the --author flag:
$ git log --author="John Doe"
Combining Filters
You can combine multiple filters to narrow down your search even further. For example, to find all commits by a specific author within a certain time frame, you can combine the --author and --since flags:
$ git log --author="John Doe" --since="2023-01-01"
Tip
Searching Commits in Tower
In the Tower Git client, you can easily filter your commit history. A dedicated search bar allows you to filter by message, author, file path, commit hash, and date. Of course, you can also combine these filters to narrow down your search.
Get our popular Git Cheat Sheet for free!
You'll find the most important commands on the front and helpful best practice tips on the back. Over 100,000 developers have downloaded it to make Git a little bit easier.
About Us
As the makers of Tower, the best Git client for Mac and Windows, we help over 100,000 users in companies like Apple, Google, Amazon, Twitter, and Ebay get the most out of Git.
Just like with Tower, our mission with this platform is to help people become better professionals.
That's why we provide our guides, videos, and cheat sheets (about version control with Git and lots of other topics) for free.