Notes: Using GitHub search
I’ve recently been experimenting more with GitHub search. Much of this has taken place using GitHub’s command line tool: gh. I wanted to learn more, since I began to see the usefulness of this tool. The goal, then, was to identify ways I could be more productive using search. This involved a review of GitHub’s docs. The following are notes from my review.
This post is written in the spirit of publishing more frequent blog posts. It’s a bit of a scratchpad of ideas, concepts, and ways of working that I found to be useful or interesting. As such, what’s here is lightly edited. Be aware: there will likely be spelling, grammatical, or syntactical errors along with some disjointed, incomplete ideas.
What is GitHub search?
Search allows you to navigate and find almost anything available within GitHub. This includes code, issues, pull requests, and discussions. GitHub search enables broad searches across all repositories, and it also can be used to target a search. For instance, search can be targeted at specific organizations or repositories you own. GitHub search also provides search qualifiers. Search qualifiers are key value pairs, which help limit the results to very specific search criteria.
How do you use GitHub search?
Although search fields within GitHub’s UI include this feature, this post focuses on the use of GitHub search from the command line. If you’re not familiar with the GitHub CLI tool, I highly suggest checking it out.
The gh search command is what’s used to search GitHub. This command can be used to search code, commits, issues, prs, and repos. You just need to specify where you want to search when you use the command. For instance, you would use the following when searching:
gh search code- search codegh search commits- search commitsgh search issues- search issuesgh search prs- search pull requestsgh search repo- search repos
Qualifiers and command flags can also be passed along with your search query to further narrow your search results. For instance, let’s get an output of all the repos owned by the Tidyverse:
gh search repos org:tidyverse --limit 50Or, how about we list all the Tidyverse repos with greater than 500 stars:
gh search repos org:tidyverse stars:">500"More about search can be found by running the following in the terminal:
gh search --helpI learned you can’t explore issues within a forked repo. You have to use either an org or repo qualifier to explore the issues and PRs from repos you don’t own but may have forked.
My personal repos lack the use of issues, which limits my ability to create relevant examples. Moreover, any issues in my personal repos mostly involve just myself. As such, some of the examples below will utilize the more active, open-source repos owned by the Tidyverse. When it comes to searching people, I’ll utilize some well known and active R developers: Hadley Wickham and Jenny Bryan
List issues and pull requests
A great use case for search is being able to find what we’re looking for in a repo’s issues or pull requests. Before initiating a search, though, we likely want to get an overview of what’s in our repo. gh’s list command–as the name implies–can be used to output a list from our repos.
# List open issues in a repo
gh issue list
# List open PRs in a repo
gh pr listBoth commands include command flags useful for modifying output. I won’t spend much time overviewing all of these, but I will highlight some of them throughout this post, especially ones that are useful for search. I suggest reading the help docs if you want details on the different command flags that are available.
gh issue list --helpYou might also watch this video to get a rough idea of gh’s functionality.
At this point in the post, I’m going to start highlighting some searches with specific use cases that I find helpful.
Search all issues and PRs for an organization
What if we’re curious to view all the issues associated with an entire organization? This can be done by passing an organization name to the org qualifier. For instance, something like the following will return all issues associated with the Tidyverse.
gh search issues org:tidyverseSay we want to narrow our search further, we can limit it to a specific repo by passing a value to the repo parameter. The following code will do this for the ggplot2 repo, which is associated with the Tidyverse organization.
gh search issues repo:tidyverse/ggplot2What about closed issues? The is or state qualifier is useful in this case.
gh search issues repo:tidyverse/ggplot2 is:closedWhat about all the bugs that have been squashed?
gh search issues repo:tidyverse/ggplot2 is:closed label:bugHow about recently closed issues related to bugs? Say ones closed since the start of the year.
gh search issues repo:tidyverse/ggplot2 is:closed label:bug created:"2025-01-01..2025-08-31"Search for anyone involved with an issue or pull request
Say you’re not sure whether someone has authored, been assigned, mentioned, or commented within a repo. The involved qualifier can be useful. How about we know Jenny Bryan was a part of some issue we’re trying to track down, but we can’t remember exactly what role she took in that issue. Well, the involved qualifier is an OR statement for the author, assignee, mention, or commented role within a PR or issue. So to broadly search issues or PRs Jenny Bryan was involved, we can run the following from the terminal.
gh search issues involves:jennybc org:tidyverse
gh search pr involves:jennybc org:tidyverseSearch by commenter
Authors are a great start, but we can be even more specific and narrow the results further. Say we want to target just commenters. Why? Well, sometimes I remember I made comment on an issue or pull request, walk away for some time, come back to a project, and vaguely remember I commented somewhere. Or, at times I’ll remember someone somewhere mentioning something within an issue–but I won’t exactly remember which one. The commenter qualifier is helpful in this case.
Take for example the ggplot2 repo. What if we want to filter all the closed issues Hadley has commented on. We can use the following:
gh search issues repo:tidyverse/ggplot2 commenter:hadley --state closedThe author and commenter qualifiers are great starts for narrowing results to specific people. However, there’s other qualifiers you might consider. These include assignee and mentions. The filtering is the same, you just need to swap the qualifier with the role you wish to target.
Search by dates
Oftentimes issues become stale. They’re just not worked on. As such, you may only want to see issues filed in the past month or were created during a specific date range. Search queries by dates can be useful here:
# list issues created on or after the first of May 2025
gh search issues org:tidyverse created:">=2025-05-01"
# list issues created before 2025
gh search issues org:tidyverse created:"<2025-01-01"
# list issues created in the month of May 2025 that are still open
gh search issues org:tidyverse created:"2025-05-01..2025-05-31" --state openLet’s go back to the ggplot2 repo once again for a couple of examples.
Say we want to view all the PRs that have been created and are still open since the start of the month. It’s currently August of 2025, so let’s use that date.
gh search issues repo:tidyverse/ggplot2 created:">=2025-08-01" --state openIt looks like there’s a total of 6 open issues in the repo as of the writing of this post. It also looks like there’s an issue for tracking a major release of ggplot2 v4.0.0. That’s an interesting find.
Target searches to the title, body, or comments of an issue or PR
Say, for instance, we want to limit our search to just the title of an issue. To do this, we can use the in:title qualifier. What about issues related to already closed releases? We can search for these by running the following:
gh search issues release in:title repo:tidyverse/ggplot2 --state closedSorting results
We can also sort results in meaningful ways, like sorting by the number of comments. The --sort flag is used for sorting our results. Let’s apply this to our previous search.
gh search issues release in:title repo:tidyverse/ggplot2 --state closed --sort "comments"Several values are available that can be passed to the --sort flag. Check out gh’s docs for additional info.
Filter by label
Say we want to filter out all bug issues. The label qualifier along with the - (i.e., negate) can be used. Here’s what this looks like from the terminal:
gh search issues repo:tidyverse/ggplot2 -label:bugWe can also identify issues that don’t have any tags in our repo by using the --no-label flag. Super useful for when you need to do some issue clean up in your repos.
Code search
One powerful aspect of GitHub’s search is the ability to search your entire code base. This can be a search of code in all public repos on GitHub or just to the ones you own. Search qualifiers to further narrow results is also available for code searching. For instance, I like to drop TODO tags in code some times. These serve as markers or places I need to do some more work or fix something. But, alas, some times I forget where I’ve placed these markers.
You can search for these at the global or organizational level by running the following:
gh search code TODO --owner=tidyverseIt looks as though some developers and maintainers of the Tidyverse utilize this convention to denote to-do items. That’s a pretty neat find.
Or, you can make the search more localized, say by targeting a specific repo. Is the to-do convention used in ggplot2?
gh search code TODO --repo=tidyverse/ggplot2Indeed, it is!
The possibilities are endless here when it comes to searching code within GitHub.
Identifying issues with no assignee
At times, when you’re on the fly, you’re just creating issues to flag things you want to address later. When I do this, I often don’t specify an assignee. So, to clean things up, it’s often nice to go through repos and identify issues that were created and don’t have an assignee. The no qualifier is great for this use case.
gh search issues org:tidyverse no:assigneeWrap up
Well that’s it for this set of notes. GitHub search is a useful, powerful tool to learn. It can make you be more productive when working with issues, pull requests, code, and repos. I had fun learning more about it, and I hope you did to.
Resources
If you want to learn more about how to leverage GitHub’s search features, check out the following docs for more info:
- About searching on GitHub
- Searching issues and pull requests
- Understanding the search syntax
- GitHub Search Cheat Sheet
If you found these notes useful or are just interested in the use of GitHub search, let’s connect:
- BlueSky: @collinberke.bsky.social
- LinkedIn: collinberke
- GitHub: @collinberke
Reuse
Citation
@misc{berke2025,
author = {Berke, Collin K},
title = {Notes: {Using} {GitHub} Search},
date = {2025-09-01},
langid = {en}
}