gpt4 book ai didi

git - 如何使用 GitHub API 获取任何分支中的一个文件的提交历史记录?

转载 作者:行者123 更新时间:2023-12-04 04:14:58 27 4
gpt4 key购买 nike

我尝试了以下端点,但它只返回最新的提交。我想获得涉及我的文件的所有提交的列表。有什么方法可以使用 github api 做到这一点吗?

我尝试过的端点: https://api.github.com/repos/:owner/:repo/commits/heads/:branch_name?path=file/path.py

最佳答案

要获取特定分支上特定文件路径的完整历史记录,请使用:

https://api.github.com/repos/:owner/:repo/commits?path=path/to/file.py&sha=master

例如:https://api.github.com/repos/torvalds/linux/commits?path=CREDITS&sha=master

关于git - 如何使用 GitHub API 获取任何分支中的一个文件的提交历史记录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60924161/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com