Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在签出github请求时处理错误?_Git_Github - Fatal编程技术网

如何在签出github请求时处理错误?

如何在签出github请求时处理错误?,git,github,Git,Github,我已经使用命令从github签出了一个pull请求 git clone <repo> cd <repo> 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"

我已经使用命令从github签出了一个pull请求

git clone <repo>
cd <repo>
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

如何解决这个问题

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

回答:

cd ..
rm -rf <repo>
git clone <repo>
cd <repo>
gh pr checkout 19
cd。。
rm-rf
git克隆
光盘
生长激素受体检测19

您删除整个存储库,重新克隆,然后再次签出请求。

您真的克隆了repo还是重新使用了您已经拥有并刚刚提取的repo?我想我做了一个新的克隆。根据您的回答,您没有,因为您必须先删除旧存储库。最可能的情况是,您在本地克隆中有提交,从未推送它们,从未获取它们,拉取,由于历史差异而被拒绝。然后,删除了本地存储库,克隆了一个新的存储库,拉了pr,一切正常。另外,你确实像“昨天”(在过去的密宗中)那样从那个分支中提取,然后有人
git push-f
远程销毁你提取的一个提交,并推送新的发散的一个。质量很差的答案。你尝试重新使用本地回购协议。在这里,您提交了内容,而没有从远程获取,在远程,其他人在同一个分支上推送了提交。最后,你的分支和遥控器发生了分歧。你的解决办法就是摆脱当地的垃圾!我不在乎本地回购协议发生了什么变化。我只希望它与github中的状态相同!
CONFLICT (content): Merge conflict in folder/some_file.py
Automatic merge failed; fix conflicts and then commit the result.
cd ..
rm -rf <repo>
git clone <repo>
cd <repo>
gh pr checkout 19