By Quinn Slack on December 5, 2017
Search code over all of your company's repositories, save and reuse common search queries and scopes, and do it all more quickly with style. This release also includes previews of diff/commit search and author/date filters, which help you debug issues and find usage examples in your company’s code.
Sourcegraph gives the power of great code search to every developer at your company, so you can ship better code faster. It runs securely in your own network and is easy to install and upgrade.
Key highlights of Sourcegraph 2.3:
Sourcegraph now integrates more closely with GitHub.com and GitHub Enterprise to synchronize the list of searchable repositories. You can now specify a token for a bot user with access to the precise set of repositories to make searchable on Sourcegraph. This works for public and private repositories. You can even connect your Sourcegraph instance to GitHub.com and multiple GitHub Enterprise servers at the same time.
Previously, server admins needed to add each repository manually. That still works for any Git repository host, and we'll expand this easier integration method to support more hosts soon.
See how to set up Sourcegraph to search over repositories hosted on:
By popular request, we've added a light color theme in addition to our current dark theme! It's not just aesthetic: we've heard from people who use Sourcegraph on their daily train commute and on the beach (really!), and the light color theme handles glare better. Click the sun/moon toggle next to your profile avatar to switch between the light and dark themes.
You can now create and join organizations (also known as “orgs”). Organizations are named groups of users with an associated JSON settings file. These settings take effect for all users who are members of the organization. What kinds of settings, you might ask? This release includes custom search scopes and saved queries, and more features that rely on configuration will be rolling out soon.
Server admins can create organizations that new users automatically join, and any user can create organizations and invite new members from the settings page.
Every project and team has a different set of repositories they commonly work with and search over. We've added custom search scopes to enable users and organizations to search over predefined subsets of files and repositories. Instead of typing the set of files and repositories you search over, you can now simply define a search scope and select it from the dropdown next to the search box whenever you need.
Saved queries let you save and describe search queries so you can easily monitor the results on an ongoing basis. You might think of them as the beginning of “Google Alerts or IFTTT/Zapier for your code.”
You can create a saved query for anything searchable, including (with this release) diffs and commits across all branches of your repositories. Saved queries can be an early warning system for common problems in your code--and a way to monitor best practices, the progress of refactors, etc.
See some examples of useful saved queries, including:
Server admins now have a dashboard to view and manage users and usage. Go to User menu > Site admin to see the site admin area. Add admin users in the Users site admin page.
Sourcegraph now supports single sign-on (SSO) user authentication via OpenID Connect and SAML 2.0. This includes (but is not limited to) support for the following SSO providers: Okta, OneLogin, Ping Identity, Auth0, Salesforce Identity, and Microsoft Azure Active Directory.
The Sourcegraph browser extension (Chrome/Firefox) now supports self-hosted Sourcegraph instances. After entering the Sourcegraph URL in the browser extension's options menu (revealed by clicking on the Sourcegraph icon in the browser toolbar), you'll get code intelligence on GitHub.com or GitHub Enterprise.
Click Browse in the navigation bar to view a list of all repositories on the server that are available for searching and browsing.
Markdown files are now rendered. See an example rendered public markdown file on Sourcegraph.com. To view raw markdown, click the “View source” button on the top right of the code view.
The file tree now only shows the siblings of the current file, so it’s much easier to use when you’re deep inside a repository. And it does the right thing if you navigate to parent directories using the breadcrumbs. Previously the file tree would always show the entire tree, but based on feedback, we think the new tree works better for both large and small repositories.
y key when viewing a file to go to its permanent, canonical URL, with the full 40-character Git commit SHA in the URL.
Sourcegraph Enterprise customers get all of these improvements plus more, including code intelligence improvements and others detailed separately in the Enterprise release notes.
We’re also excited to ship previews of other features, by popular demand. We expect these features to be out of preview for next month’s release. In the meantime, please try them, send feedback, and report issues.
You can now search over commit diffs using the
type:diff operator in search queries. This is useful when debugging issues (“what changed about the parseDocument function?”) and finding usage examples (“show me a self-contained commit adding a new page to our web app”). See a sample diff search on a public repository on Sourcegraph.com.
But that’s not all! For the intrepid, you can search within commit diffs on multiple branches by specifying them in a
repo: field after the
@ sign. See non-master-branch commits containing
const in a public repository on Sourcegraph.com, for example. After the
@, separate Git refs with
:, specify Git ref globs by prefixing them with
*, and exclude commits reachable from a ref by prefixing it with
^. We’ll improve documentation as this feature nears release.
Like diff search above, but use
type:commit to search inside commit messages. See all commits mentioning “bug” or “fix” in a public repository on Sourcegraph.com, for example.
To go along with diff and commit search, we’ve added new search filters. While in preview, these filters only apply to
type:commit searches, not to normal file searches.
author:[email protected]to show only diffs or commits authored by that user (example)
committer:[email protected](same as above, but for the Git committer, which sometimes differs from the Git author)
after:”3 weeks ago”,
before:”june 25, 2017”,
before:”last thursday”, etc., to filter by commit date (example)
message:”hello”to show only commits or diffs whose commit message (including the full message body) contains “hello” (example)
See the Sourcegraph changelog for a list of all changes in this release.
Want Sourcegraph? Install Sourcegraph for free with a single command.
Current customers can update now.