无法解决PR中的GitHub冲突 [英] Cannot resolve GitHub conflict in PR
问题描述
我在GitHub存储库(其他人的一些其他PR)中有一个PR,因为冲突无法合并。
我该如何解决这些冲突我尝试了以下方法:
- 从PR创建新分支
- 签出,取消并合并master
- 手动修复冲突。很多工作。
- 在本地进行测试,它可以正常工作。 :)
- 移动所有文件
git add。
- 提交并推送
>
- 创建一个新的公关
- 然后仍然显示消息此分支有冲突,必须解决。 >
我做错了什么?本地一切正常,
git status
报告:
$ b blockquote>
分支分支2
您的分支是'origin / branchX'的最新版本。
无需提交,工作目录干净
$ b:b
PS:如果我重做合并主人,所有的冲突都回来了。不要这样。
解决方案通常的工作流程是:
$ ul
- 确保你有
上游, c>是远程引用原始repo的名称上游$ c $>的最新
master
git fetch upstream
然后你创建你自己的分支(在你自己的分支中,你从另一个fork获取PR分支)
git checkout -b branch2 otherfork / PRbranch
而你 分支位于
上游/主人
之上
这是关键:没有合并:仅限于重新绑定,这样,您将解决冲突,并且
branch2
的结果历史记录将在upstream / master
,这将使PR在应用(合并)到原始repo中的master
时进行简单的快速合并(上游
一个)。I have a PR in a GitHub repository (some one else his PR), which cannot be merged because of conflicts.
What can I do to fix those conflicts by myself?
I tried the following:
- Create new branch from PR
- Checkout, pull and merge master
- Fix the conflicts manually. Lot of work.
- Test it locally, it works. :)
- Stage all the files
git add .
- Commit and push
- Create a new PR
- And then still the message "This branch has conflicts that must be resolved".
What I'm doing wrong? Locally everything works and
git status
reports:On branch branch2 Your branch is up-to-date with 'origin/branchX'.
nothing to commit, working directory clean
PS: If I redo "merge master", all the conflicts are back. Don't get this.
解决方案The usual workflow is:
- make sure yo have the latest
master
fromupstream
,upstream
being the name of the remote referencing the original repo in a triangular workflow)
git fetch upstream
Then you create your own branch (in your own fork, where you have fetch the PR branch from another fork)
git checkout -b branch2 otherfork/PRbranch
And you rebase that branch on top of
upstream/master
This is key: no merge: rebase only, that way, you will resolve conflicts, and the resulting history of
branch2
will be additional commits on top ofupstream/master
, which will make the PR a simple fast-forward merge when applied (merged) tomaster
in the original repo (theupstream
one).这篇关于无法解决PR中的GitHub冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!