Pull request in GitHub does not show merge conflict was fixed and doesn't show my commits
I’m fixing merge conflicts for other contributors at the command line. Still learning how Git works here, so bear with me…
git checkout -b otherusersbranch master git pull https://github.com/otheruser/myrepo.git otherusersbranch
….find and fix conflicts
git add . git commit -m "fixing merge conflicts" git push origin otherusersbranch git checkout master git merge --no-ff otherusersbranch git push origin master
When the merge conflict appears corrected from the command line, I’m pushing the change to the contributor’s branch like normal. However, the merge conflict indicator in the pull request has remained unchanged and I can’t see my commits in the pull request. What am I doing wrong?
3 Solutions collect form web for “Pull request in GitHub does not show merge conflict was fixed and doesn't show my commits”
I don’t think you are successfully pushing the changes to the user’s branch. Try submitting a pull request to that branch. Otherwise, you need to give yourself permission to push directly.
From what you’ve described, you’re only pushing changes to your own branch, which is why it’s not showing up in the commit history.
Assuming you are on otheruser branch, you could just pull your buddies changes by doing
git pull https://github.com/otheruser/myrepo.git otherusersbranch
Then solve the merge conflicts, add your commit and push this to your remote. You can’t push your changes to your friend’s branch unless he has given you the right access.
Ideally, you want him to push his changes to a central repo where you both can fetch and work off, you apply your commit on the top of his and send a pull request.
If you can push to your contributor’s branch directly (which I am getting from the assumption that
https://github.com/otheruser/myrepo.git is your fork and
origin is your contributor’s), then the reason the edits are not showing up in the pull request from your fork to origin is that you are pushing the changes directly, thus circumventing the pull request process.
To explain: When you open up a pull request from your fork against your friend’s fork and they merge it, that is equivalent to their having done
git fetch <your-fork> master git merge <your-fork>/master
git pull <your-fork> master
git push <their-fork> master
If you just go ahead and push to
<their-fork>, which in this case is origin, then you have essentially already done what the pull request would have done. Additionally, when you pushed to
<their-fork> instead of
<your-fork> after fixing the merge conflicts, github sees exactly the same merge conflicts as before in the pull request because
<your-fork> has not been updated, so now you have merge conflicts against the “fixed” version. When the PR process is circumvented, git has no idea, but gitHUB gets very confused (pull requests are entirely github-based — there is no concept in of a “pull request” in git itself).
The simplest way to fix this is to simply close the open PR, since you have essentially merged it anyway. However, if you want to preserve the pull request workflow, you could grab your friend’s master branch, do a
git reset --hard
to before you pushed to it, and then
git checkout -b tmp git cherry-pick otheruserbranch <list-of-commits-you-made> git checkout master git merge tmp git push <your-fork> master
which would get your PR back to looking like you want it to (you may have to make some adjustments there, I am not super clear on your branch structure, but that’s the gist)
NOTE: Look here for documentation on
git reset, and be sure you understand the consequences of a hard reset before using it.