无法解决PR中的GitHub冲突 [英] Cannot resolve GitHub conflict in PR

查看:1020
本文介绍了无法解决PR中的GitHub冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在GitHub存储库(其他人的一些其他PR)中有一个PR,因为冲突无法合并。



我该如何解决这些冲突我尝试了以下方法:


  1. 从PR创建新分支
  2. 签出,取消并合并master

  3. 手动修复冲突。很多工作。

  4. 在本地进行测试,它可以正常工作。 :)

  5. 移动所有文件 git add。

  6. 提交并推送
  7. >
  8. 创建一个新的公关

  9. 然后仍然显示消息此分支有冲突,必须解决。 >

    我做错了什么?本地一切正常, git status 报告:
    $ b blockquote>

    分支分支2
    您的分支是'origin / branchX'的最新版本。



    无需提交,工作目录干净


    $ b:b

    PS:如果我重做合并主人,所有的冲突都回来了。不要这样。

    解决方案

    通常的工作流程是:

    $ ul

  10. 确保你有上游,上游的最新 master c>是远程引用原始repo的名称

      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:

    1. Create new branch from PR
    2. Checkout, pull and merge master
    3. Fix the conflicts manually. Lot of work.
    4. Test it locally, it works. :)
    5. Stage all the files git add .
    6. Commit and push
    7. Create a new PR
    8. 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 from upstream, 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 of upstream/master, which will make the PR a simple fast-forward merge when applied (merged) to master in the original repo (the upstream one).

    这篇关于无法解决PR中的GitHub冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆