5

My team uses individual feature branches for each developer, then merge the code to develop branch through a pull request and then merge the develop branch to testing branch through a pull request.

I know if multiple developers are working on a single branch and pushing their code, in case they get a conflict, intellij would automatically pop up the conflict resolution windows, which we can easily use to accept the required changes from respective commits.

I have been trying to use the same intellij option for merge conflicts in a pull request from develop to testing. Is it possible to do so. I have referred some intellij docs but none of them address this issue. I am using bitbucket stash, if it helps.

sss
  • 598
  • 6
  • 24

2 Answers2

3

Check if IntelliJ IDEA does support git rerere, which would allows you to reuse conflict resolutions from one PR merge step to the next.

The other approach would be to:

  • refuse merging any PR with conflict
  • force a local rebase (or local merge probably, since rebase a common branch like develop or testing is not convenient) in order to resolve conflicts locally.
  • make a new PR from the updated branch, this time without conflicts, since they were resolved locally in the previous step.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for your answer. I checked the man document of git rerere and it got me all confused again. Followed your other advice and got to learn about some interesting caveats of bitbucket like PR remotely merged by someone without getting it through approver and empty pull requests. Also learned how to avoid these :). I was wondering if u could explain in simple terms what git rerere does and if there is any mergetool which supports it by default. – sss Aug 06 '19 at 16:39
  • @SameerSinha Regarding git rerere: https://stackoverflow.com/a/49501436/6309. Remember this is only local, so useful for local merge conflict resolution (happeing during the local rebase). See more at https://medium.com/@porteneuve/fix-conflicts-only-once-with-git-rerere-7d116b2cec67. And https://mtyurt.net/post/git-mergetool-outputs-no-files-need-merging-while-git-rerere-enabled.html – VonC Aug 06 '19 at 22:32
3

Found the solution for this.
If we are getting merge conflict in a PR raised from source branch to destination branch, to resolve it through IntelliJ GUI, follow below steps:

  • Check out the destination branch from the bottom right side option (testing).
  • Make sure the latest code is in local branch through a git pull.
  • Pull the source branch (source) through the menu options Git -> Pull.
    This will bring up the diff UI of IntelliJ.
  • Accept the changes, and then do a git push.
burkybang
  • 107
  • 2
  • 10
sss
  • 598
  • 6
  • 24
  • Hey thanks for formatting. I had formatted it on mobile, seems that didn't work – sss May 20 '20 at 08:02