Recently, I did a #15DaysOfSearch Twitter campaign to show developers how they can optimize their workflow by mastering code search on sourcegraph.com.
Here's the recap from Day 1 to Day 15:
Day 1
Today commences the beginning of #15DaysOfSearch.
I'll show you cool, resourceful & awesome @sourcegraph code search tricks you should be using over the next 15 Days.๐คฉ
Day 1: Search for commit messages matching a string โchoreโ in a repo with the following query:16:11 PM - 06 Dec 2021
Day 2
Day 2 of #15DaysOfSearch
How to search for code or anything in all branches of a repo starting with "emchap". โ
Note: "emchap" could be any string or set of characters.18:50 PM - 07 Dec 2021
Day 3
Day 3 of #15DaysOfSearch ๐ฅ ๐
Today, we'll perform a diff search on repos. With @sourcegraph, you can run a query like so:
Search Query: repo:^github\.com/sourcegraph/sourcegraph$ type:diff matrix18:28 PM - 08 Dec 2021
Day 4
Day 4 of #15DaysOfSearch ๐
Today, weโll learn how to perform a symbol search on @sourcegraph.
With the type:symbol filter, you can search for specific functions, classes, struct definitions & more in your codebase.
Let's search for newrouter in Go codebases. ๐14:52 PM - 09 Dec 2021
Day 5
Day 4 of #15DaysOfSearch ๐
Today, weโll learn how to perform a symbol search on @sourcegraph.
With the type:symbol filter, you can search for specific functions, classes, struct definitions & more in your codebase.
Let's search for newrouter in Go codebases. ๐14:52 PM - 09 Dec 2021
Day 6
Day 6 of #15DaysOfSearch ๐ฅ๐
Today, we'll look at how you can discover secrets, private keys and tokens quickly across your codebase with @sourcegraph code search.
With a regular expression search, you can do this:21:15 PM - 14 Dec 2021
Day 7
Day 7 of #15DaysOfSearch
Today we'll perform a language-specific code search on @sourcegraph.
With the "lang" keyword filter, you can narrow your search to return results for a particular language/technology.
Let's do a wild search for "lambda" ๐๐21:09 PM - 15 Dec 2021
Day 8
Day 9
Tweet: How to perform structural search queries.
Day 10
Tweet: How to limit results to display only the repos involved by using the select:repo filter.
Day 11
Tweet: Search contexts on Sourcegraph.
Day 12
Tweet: How to search archived repositories.
Day 13
Tweet: How to search forked repositories.
Day 14
Day 15
Wrapping Up
Sourcegraph users report an average of 30mins a day saved by using code search. The knowledge of Sourcegraph code search tips and tricks arms you with the confidence to move fast in any codebase.
Sourcegraph Cloud is not the only option to add, explore private code and use search contexts. Sourcegraph can be installed in different ways to give you advanced search features for your private code.
You can run Sourcegraph locally or opt-in for us to set up a managed Sourcegraph instance for your team. You'll be able to use a self-hosted Sourcegraph instance for free (up to 10 users).
Have suggestions or questions? Leave a comment, or join our Community Slack Space where our team will be happy to answer any questions you may have about Sourcegraph.
Top comments (0)