制作 Github 问题提交的补丁或 git 差异?

Make patch or git diff of Github issue commits?

在下面的 Github 问题中有 35 个提交

问题

如何获取这些提交的副本作为补丁或 git 差异,以便我可以保留这些内容的本地副本?

据我所知,并非所有提交都已被接受,但无论如何我都想拥有一份副本。

这个问题不同于this,因为那个答案中的提交都已经提交了。

您通常可以通过在 url 的末尾添加单词 .patch'.diff 来做到这一点,即:

https://patch-diff.githubusercontent.com/raw/sharelatex/web-sharelatex/pull/103.diff

然而,似乎(我认为)因为原始存储库不存在,所以这不起作用。

这也排除了手动克隆原始存储库然后在 command-line 上创建补丁的可能性。

但是,您可以通过执行以下操作来访问包含 PR 的分支:

git clone https://github.com/sharelatex/web-sharelatex
cd web-sharelatex
# edit .git/config - change the 'origin' fetch entry to:
  fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
git fetch -a
git checkout remotes/origin/pr/103

您现在可以访问该 PR 中的所有提交并生成补丁等。