首页 > 解决方案 > 如何在检查 github 拉取请求时处理错误?

问题描述

我已经使用命令检查了来自 github 的拉取请求

git clone <repo>
cd <repo>
gh pr checkout 19

使用github 命令行工具。我检查了拉取请求(它创建了一些完全不相关的更改)。其他人对该 PR 进行了更改。为了检查更新拉取请求,我尝试了

git pull
gh pr checkout 19

但我遇到了类似的错误

Switched to branch 'branch'
Your branch and 'origin/branch' have diverged,
and have 1 and 1 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
fatal: Not possible to fast-forward, aborting.
exit status 128

或者

CONFLICT (content): Merge conflict in folder/some_file.py
Automatic merge failed; fix conflicts and then commit the result.

如何解决这个问题?

注意:所做的任何更改都是完全无关的!

标签: gitgithub

解决方案


Alex 的答案稍微好一点的答案是删除分支而不是整个存储库:

git checkout master
git branch -D the-pr-branch-name
gh pr checkout 123

推荐阅读