Search across multiple revisions of the same repository


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:[email protected]:branch2:branch2. To search all branches, use repo:[email protected]*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 for free today

You'll be searching your own code in 10 minutes. You can run it self-hosted (all of your code stays local and secure).