coding4fun coding4fun - 6 months ago 48
Git Question

How to resolve merge conflict during pull request?

We generally have individual branches off of master. So for example we have a branch named "JohnMaster". John does his development locally off of JohnMaster and when he is ready to push his code to master he pushes his branch to remote and then does a pull request to master from JohnMaster. The problem were running into is we have conflicts when doing the pull request.

The way i thought we could resolve the merge conflict was to bring master down and the do a rebase locally from master-->JohnMaster and then resolve the merge conflict during the rebase. After doing the rebase it wouldn't let me push my code back up to remote because it said i was 2 commits off of remote (before the rebase they were identical) but when i do a

git pull
i get another merge conflict.

I know probably the best practice is to do a pull request from master-->JohnMaster (reverse merge) and then do a
git pull
when on JohnMaster before you ever push your commits up to remote but sometimes people forget and then we run into this issue.

So my questions are:

  1. Why does rebasing locally not work?

  2. How can we get around this issue?

Please note we can't commit directly to master. There is security on the branch that requires pull requests.

Answer Source

If you merge origin/master into JohnMaster and you push this to its remote (origin/JohnMaster), you can do the pull request from origin/JohnMaster to master and you won't get merge conflicts as long as there are no new commits on master.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download