在GitHub上展示特定日期的提交记录

44
我可以展示/搜索GitHub上特定分支的提交列表,像这样:

https://github.com/username/repository/commits/branch_name

我还可以按作者名称过滤,例如:

https://github.com/username/repository/commits/branch_name?author=author_name

但现在我正在寻找一种可以搜索特定日期或日期范围内我的提交记录的方法。我尝试查找现有答案,但都没有找到。我还尝试了一些查询,如before=2016-07-27after=2016-07-27,但它们并没有起作用。感谢您提前的帮助。

比较视图可能会有所帮助:https://github.com/github/linguist/compare/master@%7B2015-02-27%7D...master@%7B2015-03-01%7D - C-Otto
@C-Otto 谢谢。我在这里看到了 https://help.github.com/articles/comparing-commits-across-time/ 但是它没有帮助到我。 - Zohaib Ijaz
2个回答

55

根据 GitHub 的 REST API v3 文档中关于 列出存储库上的提交 的说明:

GET /repos/:owner/:repo/commits

包括sinceuntil参数:

+--------+---------+---------------------------------------------------------------+
| Name   |  Type   |                          Description                          |
+--------+---------+---------------------------------------------------------------+
| since  | string  | Only commits after this date will be returned.                |
|        |         | This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. |
| until  | string  | Only commits before this date will be returned.               |
|        |         | This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. |
+--------+---------+---------------------------------------------------------------+

举个例子,在github/linguist中选择2018年6月master分支上的提交记录:

https://github.com/github/linguist/commits/master?since=2018-05-31&until=2018-07-01

根据上面链接中的文档,分支应该包含在查询参数中,例如https://github.com/github/linguist/commits?branch=master&since=2018-05-31&until=2018-07-01,但是好像把分支名作为路径参数也能正常工作。


1
谢谢@eddies,虽然已经过了很长时间,但这将有助于其他人,我已经测试过了,它可以工作。再次感谢 :) - Zohaib Ijaz
2
很好。使用 ?since=2020-10-01&until=2020-11-01(例如 https://github.com/near/nearcore/commits/master?since=2020-10-01&until=2020-11-01)有助于查找与 https://stackoverflow.com/a/64554355/470749 相关的历史提交。 - Ryan
可以在链接后面添加 &author=github用户名 来按照用户名过滤。例如:https://github.com/github/linguist/commits/master?since=2018-05-31&until=2018-07-01&author=lildude - bobobobo

5
对于公共或 GitHub Pro 存储库,当您单击 Network(fork 旁边的数字)时,您至少可以按日期浏览。为了更轻松地导航,请使用光标键(向左移动 Shift 键以获取第一次提交)。单击圆点以转到该提交。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接