【问题标题】:How do i git checkout multiple pr我如何 git checkout 多个 pr
【发布时间】:2019-03-27 06:11:38
【问题描述】:

我是 github 新手,有 repo 或 library 吗?我正在使用的,我想运行一些尚未合并到我正在运行的分支中的可用 PR。

我都用

git fetch origin +refs/pull//merge:refs/remotes/origin/pr/

然后拉 git checkout origin/pr/1282

这行得通,我的文件夹中的文件发生了变化,然后我拉了另一个 git checkout origin/pr/1275

第一次提取的文件已还原。我如何测试/运行多个 pr?

我也尝试过,但失败了 git checkout origin/pr/1293 origin/pr/1282 origin/pr/1287 origin/pr/1269

谢谢

【问题讨论】:

  • “测试/运行多个 pr”是什么意思?在 Git 中,您通常有一个工作目录。您想合并来自多个拉取请求的更改并同时进行测试吗?

标签: git github


【解决方案1】:

git checkout 签出特定的代码版本。你说,

然后拉 git checkout origin/pr/1282

但你还没有,你已经签出

你想要做的可能是检查一个分支来工作,

git checkout -b my-merge-branch 

然后拉入你想要的 PR:

git pull origin origin/pr/1293 origin/pr/1282 origin/pr/1287

使用这些参考的所有更改创建一个新的代码版本。

【讨论】:

  • 创建并命名一个分支然后尝试 git pull 但它返回致命:找不到远程参考 pr/1293
  • 你有origin吗?
  • (.env)wings@wings:~/drytrade$ git checkout -b prbranchtest 切换到新分支 'prbranchtest' (.env)wings@wings:~/drytrade$ git pull origin pr/ 1293 pr/1282 pr/1287 pr/1269 pr/1276 致命:找不到远程参考 pr/1293
  • 无论如何,这是一个单独的问题。答案告诉你如何拉下存在的 PR;试图拉动那些显然不会发生的事情。
  • 是的,我试过 git pull origin/pr/1282,没用,git checkout origin/pr/1282 有效
【解决方案2】:

我似乎已经通过使用 git 合并 origin/pr/1293 origin/pr/1282 origin/pr/1287

【讨论】:

    【解决方案3】:

    如果以前的答案对您不起作用,则另一种选择:

    git remote add {the-repo} https://github.com/the/repo.git
    git fetch --all && git checkout {the-repo}/{the-branch}
    
    # Pull all PRs at once:
    git pull --no-commit --squash -X theirs {the-repo} pull/3/head pull/5/head pull/7/head pull/9/head
    
    # Or pull PRs one by one if all-at-one failed to merge:
    git pull --rebase -X theirs {the-repo} pull/3/head
    git pull --rebase -X theirs {the-repo} pull/5/head
    git pull --rebase -X theirs {the-repo} pull/7/head
    git pull --rebase -X theirs {the-repo} pull/9/head
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-03
      • 2013-01-07
      • 1970-01-01
      • 2018-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多