'Resolving Merge Conflict in PR from IntelliJ

I have a question for experienced developers. Merge conflicts are happening a lot during our daily work and as a Junior developer sometimes I get confused with them. And every senior developer has their own way to resolve them. I am trying to find my way 😅

For example, I have a feature branch and test branch. I push some code into the feature branch, go to GitHub website and say "Create Pull Request" because I want to merge my feature branch into the test branch. At that point, GitHub warns me and says:

enter image description here

Nevertheless, I open the PR even though I know that can't merge at the moment. Then, I have 2 options in GitHub: enter image description here

Until now I always preferred web editor to resolve the conflicts, its quite easy. (Actually, my senior developer warned me that it's not always really good to resolve them over webeditor when there are lots of conflicting files. Do you agree with that 🤔)

Also, I know that IntelliJ has very nice interface to solve merge conflicts. I mean this 3 page merge conflict view:

enter image description here

After the PR is created, how can I come to this page in IntelliJ, resolve the conflict and commit my conflict fix to the PR? And then merge to test of course..

I saw a lot of examples of doing it without having the PR or merging directly in the IntelliJ but thats not fitting to my case. In the company I am working we have coding standarts and we want to see the changes done in the PR.

I would be glad if you could answer this question! Thank you so much for reading 😊🙏



Solution 1:[1]

It's easy.

If GitHub says that merging feature into test would cause a conflict, then after the PR is approved, on your own machine you reverse merge: pull test into test to update it, and then merge test into feature.

Resolve the conflict manually in IntelliJ on your machine, push, and now on GitHub complete the forwards merge (because the conflict is gone) of feature into test, closing the PR.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 matt