git cherry-pick 不获取远程分支

标签 git github cherry-pick git-cherry-pick

我在这里遇到了一些问题,我想从我的系统本地不存在的 git 存储库中挑选一个提交。

例如:https://github.com/DespairFactor/N6/commit/ecea4ab6d3d8bb4122522398200f1cd2a06af6d5

通常的 cherry-pick 过程包括做

1) git remote add <RepoName> <repoURL>

2) git fetch <RepoName>它会下载一个副本,但不会 merge 到您自己的本地存储库中。

3) git cherry-pick <commit SHA> cherry-pick 完成。

我的下载速度非常慢 (1 mbps),而且我没有足够的时间下载 1 次提交的整个存储库。很抱歉,如果这个问题已经被提出并得到回答。

最佳答案

您可能会考虑下载补丁,然后在本地应用它。

要获取 GitHub 上特定提交的补丁,只需将 .patch 后缀附加到提交 URL:

https://github.com/DespairFactor/N6/commit/ecea4ab6d3d8bb4122522398200f1cd2a06af6d5.patch

还有一些变体形式:

参见:https://github.com/blog/967-github-secrets#diff-patch

关于git cherry-pick 不获取远程分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38633277/

相关文章:

git - 推送到 heroku 进行编译超时

git - 致命的 : unable to access 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/lambda-pipeline-repo/' : The requested URL returned error: 403

linux - 如何取回干净的 git 存储库?

git - 移除最后 pull github

git - interdiff 做 diff 做不到的是什么?

r - Git 推送失败 (Github/RStudio)

android - 如何在github和gitlab上托管Maven?

git - 如果它们不同,为什么 gitcherry-pick 不覆盖当前分支中的修改?

git - 你能从 git 提交中挑选一个或多个大块头吗?

git - 在Git cherry-pick或rebase merge 冲突中,如何确定BASE(aka “the ancestor”),LOCAL和REMOTE?