首页 > 解决方案 > 如何从 github 挑选未合并的提交?

问题描述

我想挑选这个补丁:https ://github.com/gioele/vim-autoswap/pull/17/commits/b9f49977bac269be90807dc27c9931517c84ff15

我克隆了存储库并尝试了:

git cherry-pick b9f49977bac269be90807dc27c9931517c84ff15

得到:

fatal: bad object b9f49977bac269be90807dc27c9931517c84ff15

标签: gitgithub

解决方案


好的,这是解决方案,从克隆的 github 存储库开始:

1)设置上游仓库(如果已经设置,请跳过此步骤)

git remote add upstream https://github.com/<gh_huser>/<gh_repo_name>.git

2)找到“拉请求”号。在原始帖子的情况下,它是“17”。在下一步中使用它。

3) 获取拉取请求

git fetch upstream pull/<pull_request_number>/head:<new_branch_name>


推荐阅读