2914 字
15 分钟
Github中的搜索技巧(Searching wikis for Github)

参考链接#

Searching wikis——Github

了解搜索语法——Github

Searching wikis for Github#

使用标签(关键字)查询#

Use quotations around multi-word search terms. For example, if you want to search for issues with the label “In progress,” you’d search for label:“in progress”. Search is not case sensitive.

在多个单词搜索词中使用引号。例如,如果你想去搜索针对issues为in progress时,你可以搜索label:"in progress"。搜索是不区分大小写的。

官方文档中多次提到wiki应该是指你所需要查找的知识吧,因为有类似维基百科的这种收集知识的网站。

user and org qualifier#

searching wikis within user’s or organizaion’s respositories在用户或者组织的仓库的中搜索

Qualifier 限定词Example
useruser:defunkt matches wiki pages from repositories owned by @defunkt. user:defunkt将匹配用户为Defunkt的wiki页面
orgorg:github matches wikis in repositories owned by the GitHub organization.org:github将匹配组织为Github的wikis
repo/REPOSITORYrepo:defunkt/gibberish matches wiki pages from @defunkt’s “gibberish” repository.repo:defunkt/gibberish将从用户@defunkt匹配名为”gibberish”的仓库

Search within a wiki page title or body text 搜索标题和文本内容#

The in qualifier limits the search to the wiki page title or body text. Without the qualifier, both the title and body text are searched.in限定词限制搜索为标题和内容中的文体。没有限制词,标题和内容文本都会被搜索。

Qualifier 限定词Example
inusage in:title matches wiki page titles with the word “usage.” usage in:title 匹配单词为“usage”的标题
ininstallation in:body matches wiki pages with the word “installation” in their main body text. installation in:body 匹配单词为“installation”的主要内容文本。

Search by last updated date#

The updated qualifier matches wiki pages that were last updated within the specified date range. updated限定词匹配在指定日期内被更新的wiki页面

Qualifier 限定词Example
updatedusage updated:>2016-01-01 matches wiki pages with the word “usage” that were last updated after 2016-01-01. usage updated:>2016-01-01 匹配单词为”usage”并且上次更新时间为2016-01-01的wiki页面

findingfiles in Github在github中查询文件#

  • File finder results exclude some directories like build, log, tmp, and vendor. To search for files within these directories, use the [filename](https://help.github.com/en/articles/searching-code#search-by-filename) code search qualifier.

文件查询器结果不包含一些路径名,像“build”,“log”,“tmp”和“vendor”。在这些路径中查询文件,使用“[filename](https://help.github.com/en/articles/searching-code#search-by-filename) code search qualifier

  • You can also open the file finder by pressing t on your keyboard. For more information, see “Keyboard shortcuts.”

你也可以通过按“t”键,打开文件查询器。针对更多信息,请查询Keyboard shortcuts

  1. 在Github中,进入主页面
  2. 在你的仓库名下,点击Find File

  1. 在输入框查询输入你想查询的文件名

  1. 在结果清单中点击你想查找的文件

Sorting search results对搜索结果排序#

最基本的排序方式

Sort by interactions按照互动数排序#

限定词Example
sort or sortorg sort,匹配组织为github的issues,并且按最高reaction和评论数排序** **
sortorg sort 匹配组织为github的仓库issues,以最低reaction和评论数排序

Sort by reactions 仅按照反响数排序#

限定词Example
sort or sort**org sort **匹配组织为github的仓库issues,以最高reaction数排序
sortorg sort匹配组织为github的仓库issues,以最低reaction数排序
sortorg sort:reactions-+1匹配组织为github的仓库issues, 以最多点赞 (👍) reactions排序
org sort匹配组织为github的仓库issues, 以最多点踩的 (👎) reactions排序.
org sort 匹配组织为github的仓库issues,以最多笑脸的(😄) reactions排序.
org sort 匹配组织为github的仓库issues,以最多欢呼的 (🎉) reactions排序.
org sort 匹配组织为github的仓库issues,以最多心的 (❤️) reactions排序.

Sort by author date以作者日期排序#

限定词Example
sort or sortfeature org sort 匹配提交中包含“feature”字眼,组织为github的仓库,以作者日期降序排序,即按最新排序.
sortfeature org sort 匹配提交中包含“feature”字眼,组织为github的仓库,以作者日期升序排序,即按最远的时间排序.

Sort by committer date按提交者日期排序#

限定词Example
sort or sortfeature org sort匹配提交中包含“feature”字眼,组织为github的仓库,以提交者日期降序排序,即按最新排序.
sort**feature org sort **匹配提交中包含“feature”字眼,组织为github的仓库,以提交者日期升序排序,即按最远的时间排序.

Sort by updated date 按更新日期排序#

限定词Example
sort or sortfeature sort 匹配包含“feature”字眼的仓库,以最近更新日期的排序.
sort**feature sort **匹配包含“feature”字眼的仓库,以最近较少更新日期的排序.

Searching for respository#

你通过拼接任意的修饰符去搜索仓库

You can search for repositories globally across all of GitHub, or search for repositories within a particular organization. For more information, see “About searching on GitHub.”你可以在Github中全局搜索仓库,或在一个特定组织中搜索仓库,针对更多信息,请查看”About searching on GitHub.”

To include forks in the search results, you will need to add fork:true or fork:only to your query. For more information, see “Searching in forks.”在搜索结果包含forks,你需要添加fork:truefork:only到你查询中,针对更多信息,请查看Searching in forks

For a list of search syntaxes that you can add to any search qualifier to further improve your results, see “Understanding the search syntax”.搜索语法清单,你可以添加搜索修饰符去进一步改善你的搜索结果。查看”Understanding the search syntax

Use quotations around multi-word search terms. For example, if you want to search for issues with the label “In progress,” you’d search for label:"in progress". Search is not case sensitive.使用引号包含多个单词搜索项。例如,如果你想从标签为“In progress”去搜索issues,你可以使用“label:"in progress"”,搜索不区分大小写。

search by respository name,description,content of readme file通过仓库名、描述、README文件内容搜索#

QualifierExample
injquery in matches repositories with “jquery” in their name.匹配仓库名包含jquery
injquery in,description,file matches repositories with “jquery” in their name or description.匹配仓库和描述包含jquery
injquery in matches repositories mentioning “jquery” in their README file.匹配仓库的README file 中有提到过”jquery”
repo/namerepo/hello-world matches a specific repository name.匹配一个指定的仓库名

Search based on the contents of a repository基于仓库内容搜索#

你可以“in”来搜索仓库中的README文件。

除了“in”,你没有其他方法可以查询仓库内容了。在仓库中搜索指定文件或者内容,你可以使用文件查找器或者专用搜索修饰符,更多信息,看”Finding files on GitHub” and “Searching code.”

QualifierExample
inoctocat in matches repositories mentioning “octocat” in their README file.匹配README文件有提到过“octocat”仓库

Search within a user’s or organization’s repositories在用户或者组织的仓库中搜索#

你可以通过“user”或者“org”修饰符,来搜索用户或者组织所拥有的仓库

QualifierExample
useruser forks:>100 matches repositories from @defunkt that have more than 100 forks.匹配用户为defunkt有超过100forks的仓库。
orgorg matches repositories from GitHub.匹配组织为Github的仓库

Search by repository size通过仓库大小搜索#

“size”修饰符查询仓库可以匹配指定的大小(千字节),使用greater than, less than, and range qualifiers.

QualifierExample
sizesize:1000 matches repositories that are 1 MB exactly.匹配刚好为1MB(1000字节)的仓库
size:>=30000 matches repositories that are at least 30 MB.匹配至少30MB的仓库
size:<50 matches repositories that are smaller than 50 KB.匹配小于50KB的仓库
size:50..120 matches repositories that are between 50 KB and 120 KB.匹配50KB到120KB之间的仓库

Search by number of followers搜索粉丝大小#

你可以过滤基于粉丝大小的仓库,使用greater than, less than, and range qualifiers的“followers”修饰符

QualifierExample
followersnode followers:>=10000 matches repositories with 10,000 or more followers mentioning the word “node”.匹配粉丝大于10000并且有提到过node这个单词的仓库
styleguide linter followers:1..10 matches repositories with between 1 and 10 followers, mentioning the word “styleguide linter.”匹配粉丝数量1到10之间的并且有提到过“styleguide linter”单词的仓库

Search by number of forks通过forks数量搜索#

QualifierExample
forksforks:5 matches repositories with only five forks.匹配只有5个forks的仓库
forks:>=205 matches repositories with at least 205 forks.匹配至少205个forks的仓库
forks:<90 matches repositories with fewer than 90 forks.匹配小于90forks的仓库
forks:10..20 matches repositories with 10 to 20 forks.匹配10到20个Forks的仓库

Search by number of stars通过star数搜索#

QualifierExample
starsstars:500 matches repositories with exactly 500 stars.匹配刚好500个star的仓库
stars:10..20 matches repositories 10 to 20 stars, that are smaller than 1000 KB. 匹配10到20个Star的仓库,仓库比1000KB小
stars:>=500 fork language matches repositories with the at least 500 stars, including forked ones, that are written in PHP. 匹配至少500个star、包含至少一个forks、语言为PHP的仓库

Search by when a repository was created or last updated通过仓库被创建或者最后一次更新来搜索#

You can filter repositories based on time of creation or time of last update. For repository creation, you can use the created qualifier; to find out when a repository was last updated, you’ll want to use the pushed qualifier. The pushed qualifier will return a list of repositories, sorted by the most recent commit made on any branch in the repository.

你可以过滤仓库基于创建时间或者上次更新时间。针对仓库创建,你可以使用created修饰符;你可以使用pushed修饰符查出一个上次更新时间的仓库,pushed修饰符将返回一个仓库清单,清单以近期最多的提交分类(包含分支)。

Both take a date as a parameter. Date formatting must follow the ISO8601 standard, which is YYYY-MM-DD (year-month-day). 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 (+00:00).

两个修饰符以date作为参数。date格式化必须根据 ISO8601 标准,例如YYYY-MM-DD (年-月-日)。你也可以添加可选的时间信息THH:MM:SS+00:00 在date后,这可以通过时分秒去查询。T遵循HH:MM:SS 和 UTC偏移量(+00:00).

QualifierExample
created:YYYY-MM-DDpushedwebos created:<2011-01-01 matches repositories with the word “webos” that were created before 2011.查询仓库时间为2011年之前,并且有“webos”单词的仓库
css pushed:>2013-02-01 matches repositories with the word “css” that were pushed to after January 2013.匹配2013年1月后提交的,并且有“css”单词的仓库。
case pushed:>=2013-03-06 forkmatches repositories with the word “case” that were pushed to on or after March 6th, 2013, and that are forks.匹配2013年3月6日之后(包含2013年3月6日),并且有包含单词“case”的仓库

Search by language通过语言搜索#

QualifierExample
languagerails language matches repositories with the word “rails” that are written in JavaScript.匹配语言为JavaScript并且包含单词“rails”的仓库

Search by topic通过话题搜索#

QualifierExample
topictopic matches repositories that have been classified with the topic “jekyll.”

Search by number of topics 以话题的数量来搜索#

QualifierExample
topicstopics:5 matches repositories that have five topics.
topics:>3 matches repositories that have more than three topics.

Search by license 通过开源许可证搜索#

QualifierExample
licenselicense.0 matches repositories that are licensed under Apache License 2.0.

Search by public or private repository通过私有和公共的仓库进行#

QualifierExample
isis org matches repositories owned by GitHub that are public.
isis pages matches private repositories you have access to and that contain the word “pages.”

Search based on whether a repository is a mirror以仓库是否为镜像来搜索#

QualifierExample
mirrormirror GNOME matches repositories that are mirrors and contain the word “GNOME.”
mirrormirror GNOME matches repositories that are not mirrors and contain the word “GNOME.”

Search based on whether a repository is archived搜索仓库是否归档#

QualifierExample
archivedarchived GNOME matches repositories that are archived and contain the word “GNOME.”
archivedarchived GNOME matches repositories that are not archived and contain the word “GNOME.”

Search based on number of issues with good first issue or help wanted labels 基于good first issuehelp wanted的issues数量#

QualifierExample
good-first-issues:>ngood-first-issues:>2 javascript matches repositories with more than two issues labeled good-first-issue and that contain the word “javascript.”
help-wanted-issues:>nhelp-wanted-issues:>4 react matches repositories with more than four issues labeled help-wanted and that contain the word “React.”

您可以使用 NOT 语法排除包含特定字词的结果。 NOT 运算符只能用于字符串关键词, 不适用于数字或日期。

查询示例
NOThello NOT world 匹配含有 “hello” 字样但不含有 “world” 字样的仓库。

缩小搜索结果范围的另一种途径是排除特定的子集。 您可以为任何搜索限定符添加 - 前缀,以排除该限定符匹配的所有结果。

查询示例
-QUALIFIERcats stars:>10 -language 匹配含有 “cats” 字样、有超过 10 个星号但并非以 JavaScript 编写的仓库。
mentions -org 匹配提及 @defunkt 且不在 GitHub 组织仓库中的议题
Github中的搜索技巧(Searching wikis for Github)
https://iszengmh.pages.dev/posts/github中的搜索技巧searching-wikis-for-github/
作者
Rise Zeng
发布于
2025-08-30
许可协议
CC BY-NC-SA 4.0