java如何在GitHub中获得特定版本的所有提交? 2 周,3 日 Questions & Answers 1321 我知道我可以使用GET /repos/:owner/:repo/commits在项目中获得所有提交 现在我想获得该项目的某个版本的所有提交 我该怎么办
# 1 楼答案 根据您对我问题的回答判断,您希望提交,因为有一些标签。这将需要几个步骤来完成,首先您需要获得相关标签的SHA。您需要使用git references API到get a specific reference。在您链接的特定示例中,您需要执行以下操作: GET /repos/nasa/mct/git/refs/tags/v1.8b3 您需要从存储在响应对象的“object”属性中的对象获取“sha”属性。使用'sha'属性,您将需要使用commits API到list commits starting with that 'sha',因此您的请求将如下所示: GET /repos/nasa/mct/commits?sha=%(sha_from_first_request)s 默认情况下,每页将有30次提交(如果我没记错的话),所以您应该看看在末尾添加&per_page=100是否有帮助。我无法确切地告诉您如何在Java中实现这一点,但我希望您能够使用libraries written to interact with the API中的一个来简化
# 1 楼答案
根据您对我问题的回答判断,您希望提交,因为有一些标签。这将需要几个步骤来完成,首先您需要获得相关标签的SHA。您需要使用git references API到get a specific reference。在您链接的特定示例中,您需要执行以下操作:
您需要从存储在响应对象的“object”属性中的对象获取“sha”属性。使用'sha'属性,您将需要使用commits API到list commits starting with that 'sha',因此您的请求将如下所示:
默认情况下,每页将有30次提交(如果我没记错的话),所以您应该看看在末尾添加
&per_page=100
是否有帮助。我无法确切地告诉您如何在Java中实现这一点,但我希望您能够使用libraries written to interact with the API中的一个来简化