When searching GitHub, you can construct queries that match specific numbers and words.

Query for values greater than another value

Suppose you want to find all instances of the word "cat" in repository descriptions that have been starred 10 or more times by GitHub users. You can construct a few different kinds of queries:

  • You can use > or >= to indicate "greater than" and "greater than or equal to," respectively. For example, the following search queries are equivalent:

    You can also use the > or >= symbols to search on dates. Date formatting must follow the ISO8601 standard, which is YYYY-MM-DD--that's year-month-day. You may also add some optional time information, formatted as THH:MM:SS+07:00--that's hour-minutes-seconds (HH:MM:SS), followed by a UTC offset (+07:00)

    The following queries search for issues created after April 30th, 2012 containing the word "cats":

  • The more programmatic <number> .. * notation is equivalent to >= <number>. The .. notation is called a range query. You can define range queries that are greater than a certain number. For example, the following syntax means "greater than or equal to 10":

    The following syntax finds issues created after April 30th, 2012 containing the word "cats":

    The advantage of the .. notation is that you can add an upper boundary by replacing the * with another number. For example, the following syntax means "greater than or equal to 10, but less than or equal to 50":

    The following syntax finds issues created after April 30th, 2012 but before July 4th, 2012 containing the word "cats":

Both of these operands can use any number or date range.

Query for values less than another value

What if you're interested in the least popular "cats" repositories? The syntax to find these is similar:

  • You can use < and <= to indicate "less than" and "less than or equal to," respectively. For example, the following search queries are equivalent:

    You can also use the < or <= symbols to search on dates. Date formatting must follow the ISO8601 standard, which is YYYY-MM-DD--that's year-month-day. You may also add some optional time information, formatted as THH:MM:SS+07:00--that's hour-minutes-seconds (HH:MM:SS), followed by a UTC offset (+07:00)

    The following queries search for issues created before July 4th, 2012 containing the word "cats":

  • The more programmatic * .. <number> notation is equivalent to <= <number>. The .. notation is called a range query. You can define range queries that are less than a certain number. For example, the following syntax means "less than or equal to 10":

    The following syntax finds issues created before July 4th, 2012 containing the word "cats":

    The advantage of the .. notation is that you can can add a lower boundary by replacing the * with another number. For example, the following syntax means "greater than or equal to 1, but less than or equal to 10":

    The following syntax finds issues created after April 30th, 2012 but before July 4th, 2012 containing the word "cats":

Both of these operands can use any number or date range.

Query for values between a range

The power of range queries come when you're looking for strictly non-numerical data. Let's say you're looking for "cats" repositories that were last updated between the end of April and July 4th of 2012. The syntax would look like this:

You can't search for a period of time using the >= and <= notation.

Exclude results containing a certain word

You can also narrow your search results by excluding words with the NOT syntax. Searching for Hello returns a massive number of "Hello World" projects, but changing your search to include hello NOT world returns fewer results.

The NOT operator can only be used for string keywords. It does not work for numerals or dates.

Filter qualifiers based on exclusion

Another way you can narrow down search results is to exclude certain subsets. Prefixing any search qualifier with a - excludes all results that are matched by that qualifier.

For example, you might be interested in finding all "cats" repositories with more than 10 stars that are not written in JavaScript:

You might also want to find all issues mentioning @defunkt that are not in repositories in the GitHub organization:

Omit quotation marks and spaces in queries

If you prefer a more compact notation, you can omit the quotations and the spaces for any of these criteria. Quotations need to be included only if the query contains whitespace. For example: