How to download one commit-diff from GitHub?

I would like to get one 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-patch -o .. ${SHA}~1..${SHA} $ cd .. $ rm -rf bar 

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

Obviously, GitHub can display the diff of a given commit via the web interface, but how can I extract it into a (merged) diff file (ideally, with a constant commit message)?

+83
github diff git-diff patch
Feb 20 '14 at 9:40
source share
2 answers

Well, I 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 Ten Things You Didn't Know Git And GitHub could do ...

+163
Feb 20 '14 at 9:44
source share

I found that I had to add / at the end, i.e.

 https://github.com/foo/bar/commit/${SHA}.patch/ 
+1
02 Aug.
source share



All Articles