문제

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-patch -o .. ${SHA}~1..${SHA}
$ cd ..
$ rm -rf bar

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

Obviously GitHub can display the diff of a given commit via the web interface, 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...

다른 팁

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

https://github.com/foo/bar/commit/${SHA}.patch/
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top