git - 可以从 github 中挑选所有 PR( pull 请求)吗?

标签 git github pull-request cherry-pick git-cherry-pick

是否可以从 github 中挑选所有待处理的 PR?

假设我有来自 4 个不同分支存储库的 4 个 PR 等待审查。我需要将它们全部应用到最新的源代码中。

PR#65 Do something
PR#61 Notify this
PR#55 Fix that
PR#42 Show there

我知道我可以git remote add 所有存储库并一一挑选。但是,我相信会有更简单/更快捷的方法来挑选所有待处理的 pull 请求,我还不知道 ;)

提前致谢

最佳答案

简而言之:

将 pr/* 添加到 .git/config


详细说明:

假设存储库名为 test_repo

$ git remote -v
test_repo     http://github/testA.git (fetch)
test_repo     http://github/testA.git (push)

1。打开 git 配置

vim .git/config

2。在 [remote "test_repo"]

下添加以下行
fetch = +refs/pull/*/head:refs/remotes/test_repo/pr/*

看起来像

[remote "test_repo"]
url = http://github/testA.git
fetch = +refs/heads/*:refs/remotes/test_repo/*
fetch = +refs/pull/*/head:refs/remotes/test_repo/pr/*  <-- this line was added

3。 “git fetch”也将获取 PR

$ git fetch test_repo

 * [new ref]         refs/pull/16/head -> test_repo/pr/16
 * [new ref]         refs/pull/17/head -> test_repo/pr/17
 * [new ref]         refs/pull/18/head -> test_repo/pr/18
 * [new ref]         refs/pull/19/head -> test_repo/pr/19

4。现在你可以挑选/checkout 到 PR #xx

git cherry-pick test_repo/pr/xx 

关于git - 可以从 github 中挑选所有 PR( pull 请求)吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42968431/

相关文章:

git - 致命的 : Not a git repository (or any of the parent directories): . git

github - 在 Kaggle 中下载文件给出 - 'failed: Temporary failure in name resolution' 错误

git - 保存 github 用户名以更新子模块 azure pipeline

git - 通过自动 merge 所有更改来解决特定文件的 git 冲突

git - 如何将 git repo 提交到 git repo(不是子模块)

GIT:远程:致命:内存不足,malloc 失败(尝试分配 190135255 字节)

git - 找到修改给定行的 merge 提交?

java - Jenkins 拉取请求插件抛出 ArrayIndexOutOfBoundsException 异常

java - 使用 JGit 从 Tag 加载内容

git - 如何将 GitHub 存储库中的文件转换为 Gist