Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git pull request says "This branch has conflicts that must be resolved" [duplicate]

I forked from an open source repository and cloned from my fork. I created a feature branch, made some changes, pushed them to my forked repo, and submitted a pull request from there to the main repo.

Later I made more changes to the same local feature branch, pulled from the latest master from the open source repo, rebased my changes onto that, and pushed them up to the same feature branch on my fork. The pull request was automatically updated but now the pull request page on GitHub (in both my repo and the main repo) notes that "All checks have passed" but then says "This branch has conflicts that must be resolved".

Is this simply due to the fact that other pull requests have been merged after mine was submitted? Or could there be another reason for the conflict? How do I find out the cause?

The answers I saw before submitting this question dealt with merging branches with different names or owners. I want to know:

  1. Did I do the pull request correctly? If not, what should be different? (There were no conflicts in my local git after rebasing and before submitting the pull request.)
  2. If other updates were made to the open source master branch after I revised my pull request, would that cause the "branch conflicts" error to appear?
  3. If the pull request was done correctly and if later updates from elsewhere would not cause that error, how do I find out what caused the error?
like image 993
user962915 Avatar asked Oct 19 '22 04:10

user962915


1 Answers

It would be because of the upstream (the original repo that you forked from) has commits that aren't included in your pull request's repo (whether that's from other pull requests getting approved and merged, or just contributors' own commits is a moot point).

The solution here would be to fetch from the upstream repo (the original repo that you forked from) and resolve your merge conflicts locally so that your pull request doesn't require the original repo's reviewer(s) to have to deal with merge conflicts.

like image 151
Thomas Stringer Avatar answered Oct 21 '22 22:10

Thomas Stringer