GitHub Code Search Now Generally Available, 'Way More than grep'
Following a two-year effort that involved an invite-only, 17-month technology preview, GitHub Code Search is now generally available.
"Our goal with the new code search and code view is to enable developers to quickly find critical information scattered across their codebase, put that information into context, and ultimately make them more productive," said Microsoft-owned GitHub in a May 8 announcement.
GitHub detailed how the improved code search can help developers fix a bug, find a configuration and find a vulnerability, thanks to three new capabilities:
- An entirely redesigned search interface with suggestions, completions and the ability to slice and dice the results.
- A new code search engine rebuilt completely from scratch, making it about twice as fast as the old code search along with being far more capable (supporting substring queries, regular expressions and symbol search) and better at understanding code, being able to present the most relevant results first.
- A totally redesigned GitHub code view that tightly integrates search, browsing and code navigation.
In inviting developers to take part in the technology preview in December 2021, the company listed highlights of the project in more detail, telling developers it can help them:
- Easily find what you're looking for among the top results, with smart ranking and an index that is optimized for code.
- Search for an exact string, with support for substring matches and special characters, or use regular expressions (enclosed in
- Scope your searches with
repo: qualifiers, with auto-completion suggestions in the search box.
- Refine your results using filters like
extension: and Boolean operators (
- Search for definitions of a symbol with
- Get your bearings quickly with additional features, like a directory tree view, symbol information for the active scope, jump-to-definition, select-to-search, and more!
"One of the most fundamental tasks developers perform is reading and understanding code," GitHub said this week. "Whether planning and implementing a new feature, investigating a bug, or reviewing a pull request, developers typically spend more time reading and understanding code than writing it.
"That's why, in the past two years, we've laid out our plans to improve code search and shown off the technology that enabled us to do so."
That technology, according to a February post linked above, includes Rust, the programming language used to rebuild the company's own search engine (called Blackbird) specifically for the domain of code search. The effort also involved creating an improved search index, indexing 45 million repositories and enhancing query functionality.
GitHub originally positioned the new code search effort in the context of a unified solution comprising broader initiatives around developer productivity. Those include products such as the GitHub Copilot "AI pair programmer" and Codespaces, which provides cloud-hosted developer environments.
In fact, this week's announcement mentions "a new era of code intelligence," noting that GitHub is infusing AI tech into every aspect of software development, with GitHub Copilot X leading the charge.
Much more information on GitHub Code Search can be found on a dedicated web site, which includes a video, FAQ and a link to try it out in a browser.
About the Author
David Ramel is an editor and writer for Converge360.