尝试通过 github api 获取自特定日期或提交 ID 以来特定分支中的所有提交
Trying to obtain all commits in a specific branch since a certain date or commit id via github api
我需要定期从 api 检索特定分支上的所有提交。我想从记录的最近一次提交开始,但因为某个日期也可以。
我有的是
curl https://github.mycompany.com/api/v3/repos/&owner/&repo/commits?sha=branchname
这似乎让我得到了正确的提交,但我很好奇为什么我不能附加 &since=datetime 例如
curl https://github.mycompany.com/api/v3/repos/&owner/&repo/commits?sha=branchname&since=2021-10-19T00:00:00Z
我感觉我遗漏了一些简单的语法,但如有任何帮助,我们将不胜感激。
当您从 shell 调用 curl
时,您需要在 URL 两边加上引号。那是因为 shell 认为 &
是特殊的(它导致进程在后台 运行),所以需要引用才能将&符号视为URL.
例如:
$ curl 'https://github.mycompany.com/api/v3/repos/git/git/commits?sha=branchname&since=2021-10-19T00:00:00Z'
我需要定期从 api 检索特定分支上的所有提交。我想从记录的最近一次提交开始,但因为某个日期也可以。
我有的是
curl https://github.mycompany.com/api/v3/repos/&owner/&repo/commits?sha=branchname
这似乎让我得到了正确的提交,但我很好奇为什么我不能附加 &since=datetime 例如
curl https://github.mycompany.com/api/v3/repos/&owner/&repo/commits?sha=branchname&since=2021-10-19T00:00:00Z
我感觉我遗漏了一些简单的语法,但如有任何帮助,我们将不胜感激。
当您从 shell 调用 curl
时,您需要在 URL 两边加上引号。那是因为 shell 认为 &
是特殊的(它导致进程在后台 运行),所以需要引用才能将&符号视为URL.
例如:
$ curl 'https://github.mycompany.com/api/v3/repos/git/git/commits?sha=branchname&since=2021-10-19T00:00:00Z'