How can I get "git format-patch" output from GitHub without cloning the entire repository?

How can I get “git format-patch” output from GitHub without cloning the entire repository? I know how to download the .patch of a commit, but in order to preserve authorship I would prefer downloading a “git format-patch” file without downloading the entire repository. Is this possible somehow? If not what would be a better way instead of “git clone github.com/user/repo; cd repo; git format-patch commit”?

Thanks

I’m not sure I understand the question. You say that you know how to download the patch of a commit but you want to preserve authorship? Since I have the atom/atom repository handy, I took a look at the latest commit from that repo. Here’s the content of the patch of the commit at https://github.com/atom/atom/commit/c4b38c615f757d7155bb5aa0714e151a538a52cb.patch :

From c4b38c615f757d7155bb5aa0714e151a538a52cb Mon Sep 17 00:00:00 2001
From: Max Brunsfeld <maxbrunsfeld@gmail.com>
Date: Wed, 29 Nov 2017 13:10:00 -0800
Subject: [PATCH] Fix misplaced default chunkSize property

---
 src/text-mate-language-mode.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/text-mate-language-mode.js b/src/text-mate-language-mode.js
index a8907b0fb34..123e39f58fc 100644
--- a/src/text-mate-language-mode.js
+++ b/src/text-mate-language-mode.js
@@ -716,7 +716,7 @@ class TextMateLanguageMode {
   }
 }

-TextMateLanguageMode.chunkSize = 50
+TextMateLanguageMode.prototype.chunkSize = 50

 function selectorMatchesAnyScope (selector, scopes) {
   const targetClasses = selector.replace(/^\./, '').split('.')

and here’s the content of the only output file for the git format-patch command for that single commit:

From c4b38c615f757d7155bb5aa0714e151a538a52cb Mon Sep 17 00:00:00 2001
From: Max Brunsfeld <maxbrunsfeld@gmail.com>
Date: Wed, 29 Nov 2017 13:10:00 -0800
Subject: [PATCH] Fix misplaced default chunkSize property

---
 src/text-mate-language-mode.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/text-mate-language-mode.js b/src/text-mate-language-mode.js
index a8907b0fb..123e39f58 100644
--- a/src/text-mate-language-mode.js
+++ b/src/text-mate-language-mode.js
@@ -716,7 +716,7 @@ class TextMateLanguageMode {
   }
 }

-TextMateLanguageMode.chunkSize = 50
+TextMateLanguageMode.prototype.chunkSize = 50

 function selectorMatchesAnyScope (selector, scopes) {
   const targetClasses = selector.replace(/^\./, '').split('.')
--
2.15.0

The only difference between the output of the two are that the SHAs are longer (but functionally identical) in the GitHub output and the command-line output includes a version identifier. What output is it that is missing here?

1 Like