Github API v3-获取特定提交的差异 [英] Github API v3 - Fetch diff of specific commit

查看:88
本文介绍了Github API v3-获取特定提交的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to figure out how to fetch the diff from a specific commit on Github. (Basically, just a series of individual file diffs, associated with a particular commit).

Some of the links on this question helped me figure out how to pull the contents of a given file in a repo, but I can't figure out how to pull the file for a particular commit.

或者,更重要的是,如何拉动整个差异(与在Github上查看特定提交时所显示的差不多).

OR, more to the point, how to pull the whole diff (pretty much as displayed when looking at a particular commit on Github).

我缺少使用API​​进行此操作的简便方法吗?还是Github的Rails宝石可以做这样的事情?看了一下Git宝石,但这似乎并不是我想要的.

Is there an easy way I'm missing to do this with the API? Or a Github gem for Rails that can do something like this? Took a look at the Git gem, but it doesn't seem to be what I'm looking for.

推荐答案

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

You just need to set the Accept header in the request to 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/

这篇关于Github API v3-获取特定提交的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆