Our changelog, announcements, dev posts, and anything else we think you'll find interesting.

Search across multiple revisions of the same repository

Keegan Carruthers-Smith

Often, you need to understand the differences between code at different branches (especially for release branches that have diverged).

In Sourcegraph 3.18, you can now search across multiple revisions of the same repository by listing multiple branch names (or other revision specifiers) separated by : in your query. So to search across multiple specific branches, you’d use something like repo:myrepo@branch1:branch2:branch2. To search all branches, use repo:myrepo@*refs/heads/.

For example, a search over Sourcegraph versions 3.16 & 3.17 would look something like this:

Search over Sourcegraph versions 3.16 and 3.17

A search over all branches using @*refs/heads/ would look like this:

Search over all branches using @*refs/heads/

Be aware that searching over all branches may be slower than searching over a single branch. The cost of searching a branch is the same cost as searching a repository. To speed this up, ensure that branches are indexed with our experimental indexed non-default branches feature.

GitHub issue: #11668

Try Sourcegraph on your code.

Experience code intelligence with a free trial for you and your team, or search millions of open source repositories.

Want to deploy yourself? Try our self-hosted solution.