【问题标题】:Is it possible to get the diff for just one file using the github API?是否可以使用 github API 仅获取一个文件的差异?
【发布时间】:2014-07-25 20:04:03
【问题描述】:

使用 github API 的compare endpoint,我可以请求两个提交之间的统一差异:

curl -H 'Accept: application/vnd.github.3.diff' \
'https://api.github.com/repos/danvk/dygraphs/compare/01275da4...335011f'

使用 git 命令行工具,我可以将该差异过滤为单个文件:

git diff 01275da4..335011f dygraph.js

有没有办法用 github API 做到这一点?我意识到我可以在后处理步骤中过滤到该差异,但如果差异包含一个大文件和一个小文件,这可能会遇到 API 限制。

【问题讨论】:

  • 目前不可能。

标签: git github github-api


【解决方案1】:

无法使用当前版本 (3) 的 GitHub API。

您将不得不处理文件的混合,直到它们添加一个参数(很像清单方法具有path 标志),该参数允许您指定限制查看/比较提交方法的文件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-08
    • 2011-05-07
    • 1970-01-01
    • 2013-08-10
    • 1970-01-01
    相关资源
    最近更新 更多