如何从GitHub下载单个commit-diff? [英] How to download a single commit-diff from GitHub?

查看:309
本文介绍了如何从GitHub下载单个commit-diff?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望通过web界面从GitHub获得一次提交(让我们称它为 $ {SHA} )。



例如,如下所示:

  $ git clone http://github.com/foo/bar 
$ cd bar
$ git format-path -o .. $ {SHA}〜1 .. $ {SHA}
$ cd ..
$ rm -rf bar

...但无需复制整个存储库(问题中的回购很大)。



显然,GitHub可以通过web界面显示给定提交的差异,但我可以如何将它提取到一个(统一)diff文件中(理想情况下,提交消息保持原样)?

解决方案

好的,我自己找到了答案。

.patch (或 .diff )将提供一个很好的补丁:

  https://github.com/foo/bar/commit/$ {SHA} .patch 

感谢你不知道Git和GitHub可以做的十件事... ...


I would like to get a single commit (let's call it ${SHA}) from GitHub via the web-interface.

For example, something like:

$ git clone http://github.com/foo/bar
$ cd bar
$ git format-path -o .. ${SHA}~1..${SHA}
$ cd ..
$ rm -rf bar

...but without having to clone the entire repository (the repo in the question is large).

Obviously GitHub can display the diff of a given commit via the webinterface, but how I can extract that into a (unified) diff-file (ideally with the commit-message intact)?

解决方案

OK, found the answer myself.

Adding .patch (or .diff) to the commit-URL will give a nice patch:

https://github.com/foo/bar/commit/${SHA}.patch

Thanks to Ten Things You Didn't Know Git And GitHub Could Do...

这篇关于如何从GitHub下载单个commit-diff?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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