我在GitHub有一个项目,在过去的几年里,我已经对项目进行了一些更改。在每次提交中,我都添加了一个关于提交的小文本(例如,修复了函数A的问题)。
有没有办法下载到目前为止我提交的所有提交?我不想下载每个提交代码的更改,只是我正在编写的文本..这可能吗?
假设您从当地的Git项目中完成了工作,那么GitHub就不必参与其中。你可以检查有问题的分支,获取更新它,然后使用git log
:
git checkout master # assuming contributions go to the master branch
git pull origin master
git log --author="yaylitzis" # replace 'yaylitzis' with your actual username
拉取是必需的,因为您的本地分支可能由于某种原因没有您的所有提交。
GitHub有一个API。
https://api.github.com/repos/(username)/(repository)/commits
列出存储库的提交
GET /repos/:owner/:repo/commits
然后,您可以只读取message
对象中的所有commit
键
编辑:
如果您尝试在私有存储库上执行此操作,则必须先进行身份验证。
curl
的基本示例:
curl -u username:password https://api.github.com/repos/username/repository/commits