目錄
基於具有 good first issue 或 help wanted 標籤的議題數量搜索
一 搜索語法
查詢大於或小於另一個值的值
您可以使用 >
、>=
、<
和 <=
搜索大於、大於等於、小於以及小於等於另一個值的值。
查詢 | 示例 |
---|---|
>n |
cats stars:>1000 matches repositories with the word "cats" that have more than 1000 stars. |
>=n |
cats topics:>=5 matches repositories with the word "cats" that have 5 or more topics. |
<n |
cats size:<10000 matches code with the word "cats" in files that are smaller than 10 KB. |
<=n |
cats stars:<=50 matches repositories with the word "cats" that have 50 or fewer stars. |
您還可以使用範圍查詢搜索大於等於或小於等於另一個值的值。
查詢 | 示例 |
---|---|
n..* |
cats stars:10..* 等同於 stars:>=10 並匹配含有 "cats" 字樣、有 10 個或更多星號的倉庫。 |
*..n |
cats stars:*..10 等同於 stars:<=10 並匹配含有 "cats" 字樣、有不超過 10 個星號的倉庫。 |
查詢範圍之間的值
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.
查詢 | 示例 |
---|---|
n..n |
cats stars:10..50 匹配含有 "cats" 字樣、有 10 到 50 個星號的倉庫。 |
查詢日期
您可以通過使用 >
、>=
、<
、<=
和範圍查詢搜索早於或晚於另一個日期,或者位於日期範圍內的日期。 日期格式必須遵循 ISO8601標準,即 YYYY-MM-DD
(年-月-日)。
查詢 | 示例 |
---|---|
>YYYY-MM-DD |
cats created:>2016-04-29 matches issues with the word "cats" that were created after April 29, 2016. |
>=YYYY-MM-DD |
cats created:>=2017-04-01 matches issues with the word "cats" that were created on or after April 1, 2017. |
<YYYY-MM-DD |
cats pushed:<2012-07-05 matches code with the word "cats" in repositories that were pushed to before July 5, 2012. |
<=YYYY-MM-DD |
cats created:<=2012-07-04 matches issues with the word "cats" that were created on or before July 4, 2012. |
YYYY-MM-DD..YYYY-MM-DD |
cats pushed:2016-04-30..2016-07-04 匹配含有 "cats" 字樣、在 2016 年 4 月末到 7 月之間推送的倉庫。 |
YYYY-MM-DD..* |
cats created:2012-04-30..* 匹配在 2012 年 4 月 30 日之後創建、含有 "cats" 字樣的議題。 |
*..YYYY-MM-DD |
cats created:*..2012-04-30 匹配在 2012 年 7 月 4 日之前創建、含有 "cats" 字樣的議題。 |
您也可以在日期後添加可選的時間信息 THH:MM:SS+00:00
,以便按小時、分鐘和秒進行搜索。 這是 T
,隨後是 HH:MM:SS
(時-分-秒)和 UTC 偏移 (+00:00
)。
查詢 | 示例 |
---|---|
YYYY-MM-DDTHH:MM:SS+00:00 |
cats created:2017-01-01T01:00:00+07:00..2017-03-01T15:30:15+07:00 匹配在 2017 年 1 月 1 日凌晨 1 點(UTC 偏移爲 07:00 )與 2017 年 3 月 1 日下午 3 點(UTC 偏移爲 07:00 )之間創建的議題。 |
YYYY-MM-DDTHH:MM:SSZ |
cats created:2016-03-21T14:11:00Z..2016-04-07T20:45:00Z 匹配在 2016 年 3 月 21 日下午 2:11 與 2016 年 4 月 7 日晚上 8:45 之間創建的議題。 |
排除特定結果
您可以使用 NOT
語法排除包含特定字詞的結果。 NOT
運算符只能用於字符串關鍵詞, 不適用於數字或日期。
查詢 | 示例 |
---|---|
NOT |
hello NOT world 匹配含有 "hello" 字樣但不含有 "world" 字樣的倉庫。 |
縮小搜索結果範圍的另一種途徑是排除特定的子集。 您可以爲任何搜索限定符添加 -
前綴,以排除該限定符匹配的所有結果。
查詢 | 示例 |
---|---|
-QUALIFIER |
cats stars:>10 -language:javascript matches repositories with the word "cats" that have more than 10 stars but are not written in JavaScript. |
mentions:defunkt -org:github 匹配提及 @defunkt 且不在 GitHub 組織倉庫中的議題 |
對帶有空格的查詢使用引號
如果搜索含有空格的查詢,您需要用引號將其括起來。 例如:
- cats NOT "hello world" 匹配含有 "cats" 字樣但不含有 "hello world" 字樣的倉庫。
- build label:"bug fix" 匹配具有標籤 "bug fix"、含有 "build" 字樣的議題。
某些非字母數字符號(例如空格)會從引號內的代碼搜索查詢中刪除,因此結果可能出乎意料。
Queries with usernames
If your search query contains a qualifier that requires a username, such as user
, actor
, or assignee
, you can use any GitHub username, to specify a specific person, or @me
, to specify the current user.
查詢 | 示例 |
---|---|
QUALIFIER:USERNAME |
author:nat matches commits authored by @nat |
QUALIFIER:@me |
is:issue assignee:@me matches issues assigned to the person viewing the results |
二 搜索倉庫
按倉庫名稱、說明或自述文件內容搜索
通過 in
限定符,您可以將搜索限制爲倉庫名稱、倉庫說明、自述文件內容或這些的任意組合。 如果省略此限定符,則只搜索倉庫名稱和說明。
限定符 | 示例 |
---|---|
in:name |
jquery in:name 匹配其名稱中含有 "jquery" 的倉庫。 |
in:description |
jquery in:name,description 匹配其名稱或說明中含有 "jquery" 的倉庫。 |
in:readme |
jquery in:readme 匹配其自述文件中提及 "jquery" 的倉庫。 |
repo:owner/name |
repo:octocat/hello-world 匹配特定倉庫名稱。 |
基於倉庫的內容搜索
您可以使用 in:readme
限定符,通過搜索其自述文件中的內容來查找倉庫。
除了使用 in:readme
以外,無法通過搜索倉庫內的特定內容來查找倉庫。 要搜索倉庫內的特定文件或內容,您可以使用查找器或代碼特定的搜索限定符。 更多信息請參閱“在 GitHub 上查找文件”和“搜索代碼”。
限定符 | 示例 |
---|---|
in:readme |
octocat in:readme 匹配其自述文件中提及 "octocat" 的倉庫。 |
在用戶或組織的倉庫內搜索
要在特定用戶或組織擁有的所有倉庫中搜索,您可以使用 user
或 org
限定符。
限定符 | 示例 |
---|---|
user:USERNAME |
user:defunkt forks:>100 匹配來自 @defunkt、擁有超過 100 復刻的倉庫。 |
org:ORGNAME |
org:github 匹配來自 GitHub 的倉庫。 |
按倉庫大小搜索
size
限定符使用大於、小於和範圍限定符查找匹配特定大小(以千字節爲單位)的倉庫。
限定符 | 示例 |
---|---|
size:n |
size:1000 匹配恰好爲 1 MB 的倉庫。 |
size:>=30000 匹配至少爲 30 MB 的倉庫。 | |
size:<50 匹配小於 50 KB 的倉庫。 | |
size:50..120 匹配介於 50 KB 與 120 KB 之間的倉庫。 |
按關注者數量搜索
您可以使用 followers
限定符以及大於、小於和範圍限定符基於倉庫擁有的關注者數量過濾倉庫。
限定符 | 示例 |
---|---|
followers:n |
node followers:>=10000 matches repositories with 10,000 or more followers mentioning the word "node". |
styleguide linter followers:1..10 匹配擁有 1 到 10 個關注者並且提及 "styleguide linter" 一詞的的倉庫。 |
按復刻數量搜索
forks
限定符使用大於、小於和範圍限定符指定倉庫應具有的復刻數量。
限定符 | 示例 |
---|---|
forks:n |
forks:5 匹配只有 5 個復刻的倉庫。 |
forks:>=205 匹配具有至少 205 個復刻的倉庫。 | |
forks:<90 匹配具有少於 90 個復刻的倉庫。 | |
forks:10..20 匹配具有 10 到 20 個復刻的倉庫。 |
按星號數量搜索
您可以使用大於、小於和範圍限定符基於倉庫具有的星標數量搜索倉庫
限定符 | 示例 |
---|---|
stars:n |
stars:500 匹配恰好具有 500 個星號的倉庫。 |
stars:10..20 匹配具有 10 到 20 個星號、小於 1000 KB 的倉庫。 | |
stars:>=500 fork:true language:php 匹配具有至少 500 個星號,包括復刻的星號(以 PHP 編寫)的倉庫。 |
按倉庫創建或上次更新時間搜索
您可以基於創建時間或上次更新時間過濾倉庫。 對於倉庫創建,您可以使用 created
限定符;要了解倉庫上次更新的時間,您要使用 pushed
限定符。 pushed
限定符將返回倉庫列表,按倉庫中任意分支上最近進行的提交排序。
兩者均採用日期作爲參數。 日期格式必須遵循 ISO8601標準,即 YYYY-MM-DD
(年-月-日)。 您也可以在日期後添加可選的時間信息 THH:MM:SS+00:00
,以便按小時、分鐘和秒進行搜索。 這是 T
,隨後是 HH:MM:SS
(時-分-秒)和 UTC 偏移 (+00:00
)。
日期支持大於、小於和範圍限定符。
限定符 | 示例 |
---|---|
created:YYYY-MM-DD |
webos created:<2011-01-01 匹配具有 "webos" 字樣、在 2011 年之前創建的倉庫。 |
pushed:YYYY-MM-DD |
css pushed:>2013-02-01 匹配具有 "css" 字樣、在 2013 年 1 月之後收到推送的倉庫。 |
case pushed:>=2013-03-06 fork:only 匹配具有 "case" 字樣、在 2013 年 3 月 6 日或之後收到推送並且作爲復刻的倉庫。 |
按語言搜索
您可以基於其編寫採用的主要語言搜索倉庫。
限定符 | 示例 |
---|---|
language:LANGUAGE |
rails language:javascript 匹配具有 "rails" 字樣、以 JavaScript 編寫的倉庫。 |
按主題搜索
您可以查找歸類爲特定主題的所有倉庫。
限定符 | 示例 |
---|---|
topic:TOPIC |
topic:jekyll匹配已歸類爲 "jekyll" 主題的倉庫。 |
按主題數量搜索
您可以使用 topics
限定符以及大於、小於和範圍限定符按應用於倉庫的主題數量搜索倉庫。
限定符 | 示例 |
---|---|
topics:n |
topics:5 匹配具有五個主題的倉庫。 |
topics:>3 matches repositories that have more than three topics. |
按許可搜索
您可以按其許可搜索倉庫。 您必須使用許可關鍵詞按特定許可或許可系列過濾倉庫。
限定符 | 示例 |
---|---|
license:LICENSE_KEYWORD |
license:apache-2.0 匹配根據 Apache License 2.0 授權的倉庫。 |
按公共或私有倉庫搜索
您可以基於倉庫是公共還是私有來過濾搜索。
限定符 | 示例 |
---|---|
is:public |
is:public org:github 匹配 GitHub 擁有的公共倉庫。 |
is:private |
is:private pages 匹配您有訪問權限且包含 "pages" 字樣的私有倉庫。 |
基於倉庫是否爲鏡像搜索
You can search repositories based on whether or not they're a mirror and are hosted elsewhere. For more information, see "Finding ways to contribute to open source on GitHub."
限定符 | 示例 |
---|---|
mirror:true |
mirror:true GNOME 匹配是鏡像且包含 "GNOME" 字樣的倉庫。 |
mirror:false |
mirror:false GNOME 匹配並非鏡像且包含 "GNOME" 字樣的倉庫。 |
基於倉庫是否已存檔搜索
您可以基於倉庫是否已存檔來搜索倉庫。
限定符 | 示例 |
---|---|
archived:true |
archived:true GNOME 匹配已存檔且包含 "GNOME" 字樣的倉庫。 |
archived:false |
archived:false GNOME 匹配未存檔且包含 "GNOME" 字樣的倉庫。 |
基於具有 good first issue
或 help wanted
標籤的議題數量搜索
您可以使用限定符 help-wanted-issues:>n
和 good-first-issues:>n
搜索具有最少數量標籤爲 help-wanted
或 good-first-issue
議題的倉庫。 For more information, see "Encouraging helpful contributions to your project with labels."
限定符 | 示例 |
---|---|
good-first-issues:>n |
good-first-issues:>2 javascript 匹配具有超過兩個標籤爲 good-first-issue 的議題且包含 "javascript" 字樣的倉庫。 |
help-wanted-issues:>n |
help-wanted-issues:>4 react 匹配具有超過四個標籤爲 help-wanted 的議題且包含 "React" 字樣的倉庫。 |
三 搜索實例
# 項目名字(name)裏有 java 的
in:name java
# 名字(name)裏有 java 的並且 stars 大於 3000 的
in:name java starts:>3000
# 名字(name)裏有 java 的並且 stars 大於 3000 、forks 大於 200 的
in:name java starts:>3000 forks:>200
# 詳情(readme)裏面有 java 的並且 stars 大於 3000 的
in:readme java starts:>3000
# 描述(description)裏面有 java 的並且 stars 大於 3000 的
in:description java starts:>3000
# 描述(description)裏面有 java 的並且是 python 語言的
in:description java language:java
# 描述(description)裏面有 java 的並且 2019-12-20 號之後有更新過的
in:description java pushed:>2019-12-20
四 參考文檔
https://help.github.com/cn/github/searching-for-information-on-github/searching-for-repositories
https://help.github.com/cn/github/searching-for-information-on-github/searching-for-repositories