对 Github 问题提交进行补丁或 git diff



在以下 Github 问题中,有 35 次提交

  • https://github.com/sharelatex/web-sharelatex/pull/103/commits
  • https://github.com/sharelatex/web-sharelatex/pull/103/files

问题

我怎样才能获得这些提交的副本作为补丁或 git diff,以便我可以保留这些副本的本地副本?

据我所知,并非所有提交都被接受,但无论如何,我喜欢拥有它们的副本。

这个问题与此不同,因为该答案中的提交都已提交。

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

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

但是,似乎(我认为(因为原始存储库不存在,这不起作用。

这也排除了手动克隆原始存储库,然后在命令行上从那里创建修补程序的可能性。

但是,您可以通过执行以下操作来访问包含 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 中的所有提交并生成补丁等。

最新更新