Today we’re unveiling a new feature on GitHub that we’ve been working on for a bit now that lets you search through nearly all the public source code on the site (which is a lot).

GitHub Codesearch can be found at github.com/codesearch and will let you type in anything you’re looking for in source code and get highlighted results of any files in our public repositories that match. You will also get a sidebar with the facet counts of language breakdown of the results and repository breakdowns.
You can also search through any specific language, if you’re looking for something specific by selecting that language in the dropdown:

You can also refine your search results by clicking on one of the languages or repositories listed in the sidebar to drill down to only those results:

There are a pretty good number of things you can do with this, and we hope you enjoy it. We’ll be incorporating this functionality into more aspects of the website soon (search from the front page, search through a users repositories from their user page, search through a repos code from the project page, etc). Let us know if you find any kinks or can think of any particularly interesting application of this technology that we could incorporate into the site.
We hope you like it!


Works great! Fantastic job, guys!
This is really nice, and the fact that it is so fast is impressive. Thanks for adding this, it will definitely be useful.
Thanks! I missed this feature :).
As ahubris powered fella, to test it out, I wanted to search for the file .braids in all repos to see how many people use braid. I was hoping it would do filename searches.
Also, it seems to cleanup the query term quite a lot, for example, no searching for ruby symbols or bits of code. Or at least not highlighting them.
Searching for :braid – 0 results Searching for braid – some results, the first one being something with :braid in it.
There’s also a tiny snag in that it doesn’t escape the html in the query text field.
I suppose it’s still being worked on, but I hope me testing helps a bit too :).
ps: I actually missread Github Codesearch as Geoffrey Grosenbach at first glance.
I’ve update my bookmarklet to support this using a c: prefix.
Get it from the update post
Great to see this feature back.
pagination broken for me – all links go to the same first page
Great job, however I found 2 small bugs:
Pagination is broken and some results are missing: consider comparing: all instances of alias_method_chain against: alias_method_chain used in rails
Notice that rails is not listed in the first results.
The extra repos (like rails) are just listed in the other pages of the pagination, but I can’t tell for sure.
-Matt
This isn’t exactly important, but it would be nice if not only repo:user/* was supported but also repo:*/name
If you don’t believe that would be useful, I wouldn’t mind being able to search people’s dotfiles for a specific configuration hack or whatever (i.e. searching with repo:*/dotfiles). More probably, I would like to search for bits of code in any fork of rails (or whatever), although that would get messy unless duplication filtering was implemented.
Hrm, forgot about textile there. That should say repo:*/name.
Cool, does this mean we will be getting the project-specific search bar back as well? I hope so.
I did a search, naturally, of “shit” vs “fuck” vs “wtf”. Very interesting results. Finally, on suggestion from the company chatroom, “cocksucker”., the latter appearing only in rails, written by my esteemed colleague Trevor and checked in by me other esteemed colleague Rick. Epic luls.
Otherwise — this is super useful! Well done on shipping yet another feature. An inspiration to us all.
Hey, how’d you do it? Inverse index?
Some repositories seem to be missing.
This is great, the repo breakdown seems to be really key. This is probably like crazy-talk, but have you guys considered searching /history/? Then I would know what happened to that code I deleted and what file it used to be in?