How can I search for a commit message on GitHub?


Search Problem Overview

Not in a Git repository, but rather in GitHub specifically - how do I search just the commit messages of a specific repository/branch?

Search Solutions

Solution 1 - Search

You used to be able to do this, but GitHub removed this feature at some point mid-2013. To achieve this locally, you can do:

git log -g --grep=STRING

(Use the -g flag if you want to search other branches and dangling commits.)

-g, --walk-reflogs
    Instead of walking the commit ancestry chain, walk reflog entries from
    the most recent one to older ones.

Solution 2 - Search

Update (2017/01/05):

GitHub has published an update that allows you now to search within commit messages from within their UI. See blog post for more information.

I had the same question and contacted someone GitHub yesterday:

Since they switched their search engine to Elasticsearch it's not possible to search for commit messages using the GitHub UI. But that feature is on the team's wishlist.

Unfortunately there's no release date for that function right now.

Solution 3 - Search

As of 2017 it's a functionality included in GitHub itself.

The example search used by them is repo:torvalds/linux merge:false crypto policy

> enter image description here > GIF image from</sub>

Solution 4 - Search

The short answer is, you cannot search commit messages directly on the website. For the time being we recommend the local git grep solution others on this thread have proposed.

At one point in time GitHub did offer a git grep style search over commit messages for a single repository. Unfortunately, this approach exposed a denial of service that could render a file server inaccessible. For this reason, we removed git grep searching.

Current back-of-the envelope estimates puts the number of commits in GitHub somewhere around the 80 billion mark. Although Google engineers laugh behind our backs, this is a rather large number of documents to store in ElasticSearch. We'd love to make this dataset searchable, but it is not a trivial project.

Solution 5 - Search

This was removed from GitHub. I use:

$git log --all --oneline | grep "search query"

enter image description here

You can also filter by author:

$git log --all --oneline --author=rickhanlonii | grep "search query"

Solution 6 - Search

From the help page on searching code, it seems that this isn't yet possible.

You can search for text in your repository, including the ability to choose files or paths to search in, but you can't specify that you want to search in commits.

Maybe suggest this to them?

Solution 7 - Search

Update January 2017 (two years later):

You can now search for commit messages! (still only in the master branch)

February 2015: Not sure that could ever be possible, considering the current search infrastructure base on Elasticsearch (introduced in January 2013).

As an answer "drawing from credible and/or official sources", here is an interview done with the GitHub people in charge of introducing Elasticsearch at GitHub (August 2013)

> Tim Pease: We have two document types in there: One is a source code file and the other one is a repository. The way that git works is you have commits and you have a branch for each commit. Repository documents keep track of the most recent commit for that particular repository that has been indexed. When a user pushes a new commit up to Github, we then pull that repository document from elasticsearch. We then see the most recently indexed commit and then we get a list of all the files that had been modified, or added, or deleted between this recent push and what we have previously indexed. Then we can go ahead and just update those documents which have been changed. We don’t have to re-index the entire source code tree every time someone pushes. > > Andrew Cholakian: So, you guys only index, I’m assuming, the master branch. > > Tim Pease: Correct. It’s only the head of the master branch that you’re going to get in there and still that’s a lot of data, two billion documents, 30 terabytes. > > Andrew Cholakian: That is awesomely huge.


> Tim Pease: With indexing source code on push, it’s a self-healing process.
We have that repository document which keeps track of the last indexed commit. If we missed, just happen to miss three commits where those jobs fail, the next commit that comes in, we’re still looking at the diff between the previous commit that we indexed and the one that we’re seeing with this new push.
You do a git diff and you get all the files that have been updated, deleted, or added. You can just say, “Okay, we need to remove these files. We need to add these files, and all that.” It’s self-healing and that’s the approach that we have taken with pretty much all of the architecture.

That all means not all the branches of all the repo would be indexed with that approach.
A global commit message search isn't available for now.
And Tim Pease himself confirms commit messages are not indexed.

Note that it isn't impossible to get one's own elasticsearch local indexing of a local clone: see "Searching a git repository with ElasticSearch"

But for a specific repo, the easiest remains to clone it and do a:

git log --all --grep='my search'

(More options at "How to search a Git repository by commit message?")

Solution 8 - Search

You can do this with repositories that have been crawled by Google (results vary from repository to repository).

###Search all branches of all crawled repositories for "change license"

> "change license" site:\*/\*/commits

###Search master branch of all crawled repositories for "change license":

> "change license" site:\*/\*/commits/master

###Search master branch of all crawled twitter repositories for "change license"

> "change license" site:\*/commits/master

###Search all branches of twitter/some_project repository for "change license"

> "change license" site:

Solution 9 - Search

Since this has been removed from GitHub, I've been using gitk on Linux to do this.

From terminal go to your repository and type gitk.

In the middle of the GUI, there's a search box. It provides a good selection of filters:

Search bar

Scope - containing, touching paths, adding/removing string, changing line matching

Match type - Exact/IgnCase/Regexp

Search fields - All fields/Headline/Comments/Committer

Solution 10 - Search

This works well from within Eclipse, until GitHub adds the feature:

Enter image description here

EGit/User Guide, Searching for commits

Solution 11 - Search

As of mid-2019

  1. type your query in the top left search box
  2. hit Enter
  3. click "Commits"


enter image description here

Solution 12 - Search

If you have a local version of the repository, you might want to try this crude shell script I wrote to open the GitHub pages for all commits matching your search term in new tabs in your default browser:

for sha1 in $(git rev-list HEAD -i --grep="$1"); do
    python -mwebbrowser$sha1 >/dev/null 2>/dev/null

Just replace with the actual GitHub URL of your repository, save the script somewhere (e.g. as, make it executable (chmod +x and then add the following alias to your ~/.bashrc file:

alias githubsearch='/path/to/'

Then, from anywhere in your Git repository, just do this at the terminal:

githubsearch "what you want to search for"

and any commits that match your (case insensitive) search term will have their corresponding GitHub pages opened in your browser. (Be warned that if your search term appears in hundreds of commits, this may well crash your browser and eat your PC's CPU for a while.)

Solution 13 - Search

Using Advanced Search on Github seemed the easiest with a combination of other answers. It's basically a search string builder.

For example I wanted to find all commits in Autodesk/maya-usd containing "USD" enter image description here

Then in the search results can choose Commits from the list on the left: enter image description here

Solution 14 - Search

Here's the quick answer It's possible!!

Simply search like so in the github search box (top left):

repo:torvalds/linux merge:false mmap


enter image description here

And here's the results:

enter image description here

Read more here


All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionripper234View Question on Stackoverflow
Solution 1 - SearchdsldslView Answer on Stackoverflow
Solution 2 - SearchoktopusView Answer on Stackoverflow
Solution 3 - SearchvartecView Answer on Stackoverflow
Solution 4 - SearchTwPView Answer on Stackoverflow
Solution 5 - SearchRick Hanlon IIView Answer on Stackoverflow
Solution 6 - SearchJon CairnsView Answer on Stackoverflow
Solution 7 - SearchVonCView Answer on Stackoverflow
Solution 8 - SearchtechnosaurusView Answer on Stackoverflow
Solution 9 - SearchKirkView Answer on Stackoverflow
Solution 10 - SearchchrismarxView Answer on Stackoverflow
Solution 11 - SearchM3RSView Answer on Stackoverflow
Solution 12 - SearchMark AmeryView Answer on Stackoverflow
Solution 13 - SearchGeordieView Answer on Stackoverflow
Solution 14 - SearchstevecView Answer on Stackoverflow