您可以在所有 GitHub 内全局搜索提交,也可以在特定仓库或组织内搜索提交。 有关详细信息,请参阅“关于在GitHub上的搜索”。
搜索提交时,仅搜索存储库的默认分支。
数据重用.search.syntax_tips %}
在提交消息内搜索
您可以在消息中查找包含特定字词的提交。 例如,fix typo 匹配包含“fix”和“typo”这两个词的提交。
按作者或提交者搜索
可以使用 author 或 committer 限定符查找特定用户的提交。
| 限定符 | 示例 |
|---|---|
author:USERNAME |
[
**author:defunkt**](https://github.com/search?q=author%3Adefunkt&type=Commits) 匹配由 @defunkt 创建的提交。
| committer:USERNAME |
committer:defunkt 匹配由 @defunkt 创建的提交。
`author-name` 和 `committer-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-email` 和 `committer-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
**
匹配由 chris@github.com 提交的记录。
按创作或提交日期搜索
使用 author-date 和 committer-date 限定符来匹配在指定日期范围内编写或提交的提交记录。
搜索日期时,可以使用大于、小于和范围限定符来进一步筛选结果。 有关详细信息,请参阅“了解搜索语法”。
| 限定符 | 示例 |
|---|---|
author-date:YYYY-MM-DD |
**author-date:<2016-01-01** 匹配 2016-01-01 之前撰写的提交。
| committer-date:YYYY-MM-DD |
committer-date:>2016-01-01 匹配在 2016-01-01 之后提交的提交。
过滤合并提交
`merge` 限定符筛选合并提交。
| 限定符 | 示例 |
|---|---|
merge:true |
[
**merge:true**](https://github.com/search?q=merge%3Atrue&type=Commits) 匹配合并提交。
| merge:false |
merge:false 匹配非合并提交。
按哈希搜索
`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` 的提交。
在用户或组织的仓库内搜索
要从特定用户或组织拥有的所有存储库中搜索提交,请使用 user 或 org 限定符。 若要在特定存储库中搜索提交,请使用 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 匹配@defunkt的“gibberish”存储库中带有“language”一词的提交消息。
按仓库可见性过滤
`is` 限定符匹配具有指定可见性的存储库中的提交。 有关详细信息,请参阅“[AUTOTITLE](/repositories/creating-and-managing-repositories/about-repositories#about-repository-visibility)”。
| 限定符 | 示例 |
|---|---|
is:public |
[
**is:public**](https://github.com/search?q=is%3Apublic&type=Commits) 匹配公共存储库中的提交。
| |
| is:internal |
is:internal 匹配内部存储库中的提交。
| |
| is:private |
is:private 匹配私有存储库中的提交。
其他阅读材料
-
[AUTOTITLE](/search-github/getting-started-with-searching-on-github/sorting-search-results)