【问题标题】:Github API v3 - Fetch diff of specific commitGithub API v3 - 获取特定提交的差异
【发布时间】:2013-08-10 22:12:01
【问题描述】:

我试图弄清楚如何从 Github 上的特定提交中获取差异。 (基本上,只是一系列与特定提交相关联的单个文件差异)。

this question 上的一些链接帮助我弄清楚如何在 repo 中提取给定文件的内容,但我不知道如何为特定提交提取文件。

或者,更重要的是,如何提取整个差异(几乎与在 Github 上查看特定提交时显示的一样)。

我是否缺少一种简单的方法来使用 API 执行此操作?或者一个可以做这样事情的 Rails 的 Github gem?看了一下 Git gem,但它似乎不是我要找的。​​p>

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 github github-api


    【解决方案1】:

    您只需将请求中的 Accept 标头设置为 application/vnd.github.diff

    curl -H "Accept: application/vnd.github.diff" https://api.github.com/repos/pengwynn/dotfiles/commits/aee60a4cd56fb4c6a50e60f17096fc40c0d4d72c
    

    来源:http://developer.github.com/changes/2012-12-10-Diff-and-patch-media-types/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-04-28
      • 2011-09-01
      • 1970-01-01
      • 2020-12-31
      • 1970-01-01
      • 2019-05-10
      • 2020-09-05
      • 1970-01-01
      相关资源
      最近更新 更多