Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to download a single commit-diff from GitHub?

People also ask

How do I get a diff from github?

You can run the git diff HEAD command to compare the both staged and unstaged changes with your last commit. You can also run the git diff <branch_name1> <branch_name2> command to compare the changes from the first branch with changes from the second branch. Order does matter when you're comparing branches.

How do I download a pull request patch from github?

Every pull-request on GH can be downloaded as a beautiful mail-patch, just by appending ". patch" to the pr URL. This will generate a mail-formatted patch file, that is a little different from an usual patch file: It has e-mail metadata.


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/