So, on daily basis after working on a big feature and after creating PR, my PR builds fails(yes we have CI/CD built in). Most of the time the reason for fail is linting issue but sometime it's Merge Conflict. I used to rebase the traget branch and resolve merge conflict, but this used to recreate all the commits that I had done, just creating duplicate commits. Recently I came across a better way of resolving PR merge conflict.
Let's assume we are working on feature/branch-that-needs-to-be-merged and our working branch has created a PR against main-development-branch. The PR autobuild has failed due to merge conflict and you need to resolve this merge conflict. To resolve
checkout main-development-branch get latest checkout feature/branch-that-needs-to-be-merged get latest and then run git pull origin main-development-branch
It will display Merge conflict, resolve your merge conflict, commit and push feature/branch-that-needs-to-be-merged. Now your PR will not show any merge conflict and build will also pass. Given now you have all check pass for a succesfull merge you can go ahead and merge you code.
~ Happy coding