简体   繁体   English

使Github问题的补丁或git diff提交?

[英]Make patch or git diff of Github issue commits?

In the following Github issue are there 35 commits 在下面的Github问题中,有35次提交

Question

How can I get a copy of those commits as patches or git diff's, so I can keep a local copy of these? 我如何才能以补丁或git diff的形式获得这些提交的副本,因此可以保留这些提交的本地副本?

From what I can tell, not all commits have been accepted, but I like to have a copy of them all anyway. 据我所知,并不是所有提交都被接受,但是无论如何我都希望拥有它们的副本。

This question is different from this , as the commits in that answer have all been committed. 这个问题与不同,因为该答案中的所有提交都已提交。

You can usually do this by adding the word .patch or '.diff onto the end of the url, ie: 通常,您可以通过在网址末尾添加.patch'.diff来完成此操作,即:

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

However it appears that (I think) because the original repository isn't present, this doesn't work. 但是似乎(我认为)是因为原始存储库不存在,所以这是行不通的。

This also precludes manually cloning the original repo and then creating a patch from there on the command-line. 这也排除了手动克隆原始存储库,然后在命令行上从那里创建补丁的可能性。

However you can get access to the branch containing a PR by doing the following: 但是,您可以通过执行以下操作来访问包含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

You can now get access to all the commits in that PR and generate patches etc. 现在,您可以访问该PR中的所有提交并生成补丁等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM