4

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.

4

1 回答 1

3

通常的工作流程是:

  • 确保您拥有最新master的 from upstream,即在三角工作流upstream中引用原始 repo 的远程名称)

https://cloud.githubusercontent.com/assets/1319791/8943755/5dcdcae4-354a-11e5-9f82-915914fad4f7.png

git fetch upstream

然后你创建你自己的分支(在你自己的 fork 中,你从另一个 fork 获取 PR 分支)

git checkout -b branch2 otherfork/PRbranch

然后你将那个分支重新设置在upstream/master

这是关键:没有合并:仅 rebase,这样,您将解决冲突,并且生成的历史branch2将是顶部的附加提交upstream/master,这将使 PR 在应用(合并)到时成为简单的快进master合并原始回购(那个upstream)。

于 2015-10-27T05:51:41.880 回答