This tutorial explains how to use GitHub Code Search to find exactly what you are looking. Code Search is like Twitter Advanced Search for GitHub. It is in beta phase and it allows you to search code snippets among different repositories using some filters. You can search code by modified date or between any date range. In addition, you can search for a specific GitHub repository by size, forks, starts, and push date.
For complex search functionality in GitHub, you can now use this tool which is built right into it. Many users are getting the beta access to this powerful tool and its interface is pretty much like the Twitter Advanced Search.
Here is the complete list of search parameters that you get with this. You can now search code/users by:
- Creation Date
- Programming Languages
- Repository Size
- Push Date
- File Extension
- File Size
- Issue Status (Close/Open)
- Number of Comments
- Issue Labels
- Assigned to User
- Issue Update Before Date
- User Location
- Number of Followers
- Number of Public Repositories
- Wiki Updated Before Date
For now, you can use these parameters to search for anything on GitHub. From users to repositories to issues, they cover all. You can even find wikis and find users by location. All you have to do is fill the search boxes with the appropriate parameters and then you are all good to go.
How to use GitHub Code Search to Find Exactly what you Want?
As I already said that it is in beta access, so you need a GitHub account to ask for the access to Code Search. After it has been enabled for you, you can just follow this URL and then the main interface of this tool will show up. The main interface is simple and pretty much looks like Google.
You can expand the more options by clicking on the advanced search options. The final Code Search tool will look something like this.
Now, you start entering the information about the different parameters to search for code or users or repositories. For example, if you want to find all the users from France that have more than 20 followers then you will do something like this.
Now, hit enter and then it will show you the results. You can repeat the process again to find what you are looking for.
Good thing here is that some of the parameters can take range inputs. So, this can be useful in case you want to filter the results. Just specify the required inputs and then what’s good is that it even generates a search string. If later someone can create search query builder for GitHub, then it will be good option as you will not have to fill out the input boxes manually.
If you often struggle with the regular GitHub search to find a piece of code or certain users then the new Code Search will help. I liked the philosophy and the kind of advanced interface that it provides was needed to make the search functionality better on the platform. I personally liked it and I hope they quickly move out of the beta phase and implement it right inside GitHub soon.