Article version: Enterprise Server 2.20
Understanding the search syntax
When searching GitHub Enterprise, you can construct queries that match specific numbers and words.
You can use
<= to search for values that are greater than, greater than or equal to, less than, and less than or equal to another value.
|cats stars:>1000 matches repositories with the word "cats" that have more than 1000 stars.|
|cats topics:>=5 matches repositories with the word "cats" that have 5 or more topics.|
|cats size:<10000 matches code with the word "cats" in files that are smaller than 10 KB.|
|cats stars:<=50 matches repositories with the word "cats" that have 50 or fewer stars.|
You can also use range queries to search for values that are greater than or equal to, or less than or equal to, another value.
|cats stars:10..* is equivalent to |
|cats stars:*..10 is equivalent to |
You can use the range syntax
n..n to search for values within a range, where the first number n is the lowest value and the second is the highest value.
|cats stars:10..50 matches repositories with the word "cats" that have between 10 and 50 stars.|
You can search for dates that are earlier or later than another date, or that fall within a range of dates, by using
<=, and range queries. Date formatting must follow the ISO8601 standard, which is
|cats created:>2016-04-29 matches issues with the word "cats" that were created after April 29, 2016.|
|cats created:>=2017-04-01 matches issues with the word "cats" that were created on or after April 1, 2017.|
|cats pushed:<2012-07-05 matches code with the word "cats" in repositories that were pushed to before July 5, 2012.|
|cats created:<=2012-07-04 matches issues with the word "cats" that were created on or before July 4, 2012.|
|cats pushed:2016-04-30..2016-07-04 matches repositories with the word "cats" that were pushed to between the end of April and July of 2016.|
|cats created:2012-04-30..* matches issues created after April 30th, 2012 containing the word "cats."|
|cats created:*..2012-04-30 matches issues created before July 4th, 2012 containing the word "cats."|
You can also add optional time information
THH:MM:SS+00:00 after the date, to search by the hour, minute, and second. That's
T, followed by
HH:MM:SS (hour-minutes-seconds), and a UTC offset (
|cats created:2017-01-01T01:00:00+07:00..2017-03-01T15:30:15+07:00 matches issues created between January 1, 2017 at 1 a.m. with a UTC offset of |
|cats created:2016-03-21T14:11:00Z..2016-04-07T20:45:00Z matches issues created between March 21, 2016 at 2:11pm and April 7, 2106 at 8:45pm.|
You can exclude results containing a certain word, using the
NOT syntax. The
NOT operator can only be used for string keywords. It does not work for numerals or dates.
|hello NOT world matches repositories that have the word "hello" but not the word "world."|
Another way you can narrow down search results is to exclude certain subsets. You can prefix any search qualifier with a
- to exclude all results that are matched by that qualifier.
|mentions:defunkt -org:github matches issues mentioning @defunkt that are not in repositories in the GitHub organization|
If your search query contains whitespace, you will need to surround it with quotation marks. For example:
- cats NOT "hello world" matches repositories with the word "cats" but not the words "hello world."
- build label:"bug fix" matches issues with the word "build" that have the label "bug fix."
Some non-alphanumeric symbols, such as spaces, are dropped from code search queries within quotation marks, so results can be unexpected.