I found the way to solve Pull Request conflict is not very intuitive. Could someone give some further explanation or reasoning?
Scenario:
Two developers opened two PR at the same time. One is PR1 from branch feature-1 and the other is PR2 from branch feature-2, and they both edited a same file which will lead to conflict.
PR1 is first merged sucessfully. But PR2 now has conflict to resolve. The "official" way to resolve this is:
- in local, pull the latest main, and merege main to branch feature-2 (and resolve the conflict here);
- Push branch feature-2 to remote. And now PR2 can be proceeded.
And the network looks like as followed
My question is why cannot we just resolve the conflict by merging feature-2 into main (i.e., address the conflict directly in this step)?
In contrast, in the "official" way, we have to merge main to feature-2 and then merge back to main. It is not intuitive and tends to create confusing commit history. The only reason I can think of is the designer of PR workflow considers it is the feature developer's responsibility to resolve conflict rather than the main branch owner.
All tutorials I checked show the "official" workflow, and I believe it is the common practice. But I found it is not very intuitive. I am looking forward to more reasonings and insightful comments.