Github 精准搜索开源项目

目录

一 搜索语法

查询大于或小于另一个值的值

查询范围之间的值

查询日期

排除特定结果

对带有空格的查询使用引号

Queries with usernames

二 搜索仓库

按仓库名称、说明或自述文件内容搜索

基于仓库的内容搜索

在用户或组织的仓库内搜索

按仓库大小搜索

按关注者数量搜索

按复刻数量搜索

按星号数量搜索

按仓库创建或上次更新时间搜索

按语言搜索

按主题搜索

按主题数量搜索

按许可搜索

按公共或私有仓库搜索

基于仓库是否为镜像搜索

基于仓库是否已存档搜索

基于具有 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 组织仓库中的议题

对带有空格的查询使用引号

如果搜索含有空格的查询,您需要用引号将其括起来。 例如:

某些非字母数字符号(例如空格)会从引号内的代码搜索查询中删除,因此结果可能出乎意料。

Queries with usernames

If your search query contains a qualifier that requires a username, such as useractor, 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

发布了78 篇原创文章 · 获赞 79 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/jack1liu/article/details/104587827