Skip to main content

Enterprise Server 3.21 目前作为发布候选版本提供。

搜索提交

您可以在 GitHub 上搜索提交,并使用这些提交搜索限定符的任意组合缩小结果范围。

您可以在所有 GitHub 内全局搜索提交,也可以在特定仓库或组织内搜索提交。 有关详细信息,请参阅“关于在GitHub上的搜索”。

搜索提交时,仅搜索存储库的默认分支

提示

  • 本文包含 GitHub.com 网站上示例搜索的链接,但你可以在任何 GitHub 平台中使用相同的搜索筛选器。 在链接的示例搜索中,将 github.com 替换为 GitHub 平台的主机名。
  • 有关可以添加到任何搜索限定符以进一步改善结果的搜索语法列表,请参阅 了解搜索语法
  • 对多个字词的搜索词使用引号。 例如,如果要搜索具有标签“In progress”的问题,可搜索 label:"in progress"。 搜索不区分大小写。

在提交消息内搜索

您可以在消息中查找包含特定字词的提交。 例如,fix typo 匹配包含“fix”和“typo”这两个词的提交。

按作者或提交者搜索

可以使用 authorcommitter 限定符查找特定用户的提交。

限定符示例
author:USERNAME
[
author:defunkt](https://github.com/search?q=author%3Adefunkt&type=Commits) 匹配由 @defunkt 创建的提交。
committer:USERNAME
[
committer:defunkt](https://github.com/search?q=committer%3Adefunkt&type=Commits) 匹配由 @defunkt 创建的提交。

author-namecommitter-name 限定符按作者或提交者的姓名匹配提交。

限定符示例
author-name:NAME
[
author-name:wanstrath](https://github.com/search?q=author-name%3Awanstrath&type=Commits) 匹配作者名称中包含“wanstrath”的提交。
committer-name:NAME
committer-name:wanstrath 匹配提交者姓名中包含“wanstrath”的提交。

author-emailcommitter-email 限定符按作者或提交者的完整电子邮件地址匹配提交。

限定符示例
author-email:EMAIL
[
**
author-email:chris@github.com
**
](https://github.com/search?q=author-email%3Achris%40github.com&type=Commits) 匹配作者 chris@github.com 的提交记录。
committer-email:EMAIL
[
**
committer-email:chris@github.com
**
](https://github.com/search?q=committer-email%3Achris%40github.com&type=Commits) 匹配由 chris@github.com 提交的记录。

按创作或提交日期搜索

使用 author-datecommitter-date 限定符来匹配在指定日期范围内编写或提交的提交记录。

搜索日期时,可以使用大于、小于和范围限定符来进一步筛选结果。 有关详细信息,请参阅“了解搜索语法”。

限定符示例
author-date:YYYY-MM-DD
author-date:<2016-01-01 匹配 2016-01-01 之前撰写的提交。
committer-date:YYYY-MM-DD
[
committer-date:>2016-01-01](https://github.com/search?q=committer-date%3A>2016-01-01&type=Commits) 匹配在 2016-01-01 之后提交的提交。

过滤合并提交

merge 限定符筛选合并提交。

限定符示例
merge:true
[
merge:true](https://github.com/search?q=merge%3Atrue&type=Commits) 匹配合并提交。
merge:false
[
merge:false](https://github.com/search?q=merge%3Afalse&type=Commits) 匹配非合并提交。

按哈希搜索

hash 限定符按指定的 SHA-1 哈希匹配提交。

限定符示例
hash:HASH
[
hash:124a9a0ee1d8f1e15e833aff432fbb3b02632105](https://github.com/github/gitignore/search?q=hash%3A124a9a0ee1d8f1e15e833aff432fbb3b02632105&type=Commits) 匹配哈希为 124a9a0ee1d8f1e15e833aff432fbb3b02632105 的提交。

按父项搜索

parent 限定符匹配其父级具有指定 SHA-1 哈希的提交。

限定符示例
parent:HASH
[
parent:124a9a0ee1d8f1e15e833aff432fbb3b02632105](https://github.com/github/gitignore/search?q=parent%3A124a9a0ee1d8f1e15e833aff432fbb3b02632105&type=Commits&utf8=%E2%9C%93) 匹配哈希为 124a9a0ee1d8f1e15e833aff432fbb3b02632105 的提交的子提交。

按树搜索

tree 限定符按指定的 SHA-1 Git 树哈希匹配提交。

限定符示例
tree:HASH
[
tree:99ca967](https://github.com/github/gitignore/search?q=tree%3A99ca967&type=Commits) 匹配引用树哈希 99ca967 的提交。

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

要从特定用户或组织拥有的所有存储库中搜索提交,请使用 userorg 限定符。 若要在特定存储库中搜索提交,请使用 repo 限定符。

限定符示例
user:USERNAME
[
gibberish user:defunkt](https://github.com/search?q=gibberish+user%3Adefunkt&type=Commits&utf8=%E2%9C%93) 匹配属于 @defunkt 的存储库中带有单词“gibberish”的提交消息。
org:ORGNAME
test org:github 在属于 的存储库中匹配带有字词“test”的提交消息。
repo:USERNAME/REPO
[
language repo:defunkt/gibberish](https://github.com/search?utf8=%E2%9C%93&q=language+repo%3Adefunkt%2Fgibberish&type=Commits) 匹配@defunkt的“gibberish”存储库中带有“language”一词的提交消息。

按仓库可见性过滤

is 限定符匹配具有指定可见性的存储库中的提交。 有关详细信息,请参阅“关于仓库”。

限定符示例
is:public
[
is:public](https://github.com/search?q=is%3Apublic&type=Commits) 匹配公共存储库中的提交。
is:internal
[
is:internal](https://github.com/search?q=is%3Ainternal&type=Commits) 匹配内部存储库中的提交。
is:private
[
is:private](https://github.com/search?q=is%3Aprivate&type=Commits) 匹配私有存储库中的提交。

其他阅读材料