GitHub is home to over 24 million users and 67 million repositories, which means there are a lot of projects to find. Mastering the different ways to comb through users, repositories, issues, pull requests, commits, and code will help you find projects that need your unique set of skills or answers to the problems you are encountering.
Before diving into the specific things you can search on GitHub it is important to create a foundation of basic search skills so as more advanced functionality is introduced you are ready to handle it :muscle:.
Please keep in mind while reading this article, the numbers used are liable to change as repositories, issues, and code change over the course of time. Regardless of how much GitHub grows, these search tips will help you find exactly what you are looking for.
GitHub Search 101: Seeing the Forest for the Trees
As mentioned before, GitHub is jam-packed with repositories. Thankfully the search features on GitHub are ready to give you an assist.
At the top of your dashboard, there is a search field, just to the right of the Octocat in the top-left corner. This search field covers all of the GitHub. For instance, if you were looking for the GitHub Services Training team's `training-kit` repo, but didn't know the name you might search for training. Impressively, 120,000+ repositories are listed with `training` but the `training-kit` repo isn't listed on the first page.
Using the options in the Sort dropdown, we can get the `github/training-kit` repository to display on the first page using the `Most Forks` option. However, we can maximize our chance at finding the repository we want by using GitHub's powerful search syntax. For example, adding user:github to our search skyrockets the `github/training-kit` repository from one of 120,000+, to the number one result out of 16. By limiting the repositories to a single user, we reduced our results by a lot!
Finding a specific repository is pretty awesome, however, sometimes you might need to find something inside a project. The search capabilities of GitHub have you covered and enable you to find all kinds of neat little goodies, like repository topics, code, commits, users, and even issues and pull requests.
For instance, if you wanted to find examples of `travis.yml` files across GitHub, you could search for `travis.yml` in the search bar found on the GitHub homepage. Searching for `travis.yml` brings up some files that reference the `travis.yml` file, but aren't actually the file you were looking for. Adding the `filename:` qualifier enables you to find files with a specific name.
Search qualifiers like `filename:` and `user:` enable you to narrow your search results to what you are really looking for. For instance, if you wanted to find `travis.yml` files that use a specific `env` setting, you could search for something like this:
env: NODE_VERSION=6.9.4 DISPLAY=:99.0 CC=clang CXX=clang++ npm_config_clang=1 filename:travis.yml
Search Who Needs Assistance
By using search terms and qualifiers you can dramatically reduce your search results and find exactly what you need, even across over 67 million repositories. As a final example of using qualifiers to find a specific set of information, we can try to find all of the issues that @lee-dohm has commented on that have the word bug in them.
If we started by looking up bug we get a lot of results. We are looking for issues though, so we can either use the type qualifier or select Issues from the search results page. There are over 4.5 million issues with the word bug found on GitHub. We are looking for bugs that @lee-dohm has commented on, so we need to add another qualifier to narrow our results. By adding commenter:lee-dohm to our search string, we reduce our results to 859 results! We can take it one step further and find all of the issues that @lee-dohm has participated in that are still open by adding this qualifier to our string:
With the addition of the `state` qualifier, those 859 results have dropped down to 80, it would appear @lee-dohm gets work done.
If you have a particular strength, whether it is coding, providing documentation, or providing QA for a project, you can search for projects with open issues or pull requests to lend a hand. Instead of using the last search we used to find open issues that lee-dohm has commented on, you could look for something like this:
Inspired by the blog post by Kent C. Dodds, some repositories use a `label` named "first-timers-only" to identify issues or pull requests to help newcomers become engaged with Open Source projects.
At times, GitHub might feel like it has an a lot of information to try and sift through, but with the use of the search bar and search qualifiers, you make the giant world of software development a little bit smaller.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.