git 实验室 api 中的 git 提交是否保证被排序?

Are git commits in gitlab api guaranteed to be sorted?

https://docs.gitlab.com/ce/api/commits.html#list-repository-commits 只是表示 Get a list of repository commits in a project.。是否保证对这些提交进行排序?或者换句话说,我可以使用 page=1, per_page=1 来获取最新的提交吗?

是的。 /projects/:id/repository/commits?page=1&per_page=1 给出默认分支的最新提交。使用 ref_name 参数从不同的分支获取提交。