Search code examples
gitgithubconflictpull-request

Send a pull-request that is in conflict with another pending one


I've forked a project on GitHub and I've made some change. I want to do a pull-request of my changes.

I've seen in the main project that there is an existing pull request, and I've noticed that my changes are in conflicts with that one (we change same lines of code).

What I should do in this case? I should wait the approval of that pull-request, take changes and resolve conflicts by myself, or I should make the pull-request anyway?


Solution

  • In general, you should make the pull request sooner rather than later. One exception would be if you feel the other pull request were made in error, e.g. your peer were working on the wrong task, or he grossly misunderstood some requirement.

    Git was designed to tolerate having multiple extant branches, each of which may conflict with the other one. However, in GitHub's workflow, your branch conflicting with another one would only really manifest itself when your reviewer goes to complete the pull request. Assuming the other branch were merged into the target branch first, then your branch might show merge conflicts. And these conflicts could require manual merging. In that case, you would simply merge the target branch into your branch first, and resolve the merge conflicts. After this, the GitHub warnings should go away and your reviewer should be able to resolve the pull request.

    The other scenario would be if your pull request were completed before the other branch. In this case, you might not have any blocking merge conflicts at all, and your peer would be the one taking the steps outlines above.

    In either case, your situation is a completely normal workflow in Git/GitHub.