-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Docs][Github] explain how to rectify gh pr merge failure #66223
Conversation
|
||
:: | ||
|
||
git push -f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably worth noting that this may ask you to push potentially hundreds or thousands of patches and that this is OK.
Example.
Are you sure you want to push 248 commits? (y/N): y
This is fine, since you're pushing to a branch in your fork. The results can be seen at the bottom of #66003; only my 3 rebased commits are listed, not all 248 commits since I initially authored that PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in b86da6c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note to fellow reviewers, here's the error message you will observe if you do not update your PR with the rebased version:
$ gh pr merge --squash --delete-branch
! Pull request #66003 ([InlineAsm] wrap ConstraintCode in enum class NFC) has diverged from local branch
Message: Pull Request is not mergeable, Locations: [{Line:1 Column:58}]
and if you try to push (without -f
):
$ git push
To github.com:nickdesaulniers/llvm-project.git
! [rejected] inlineasm_constraint -> inlineasm_constraint (non-fast-forward)
error: failed to push some refs to 'github.com:nickdesaulniers/llvm-project.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. If you want to integrate the remote changes,
hint: use 'git pull' before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
(though that is probably more obvious)
I recently went to merge a PR that had a merge conflict: $ gh pr merge --squash --delete-branch X Pull request llvm#66003 is not mergeable: the merge commit cannot be cleanly created. To have the pull request merged after all the requirements have been met, add the `--auto` flag. Run the following to resolve the merge conflicts locally: gh pr checkout 66003 && git fetch origin main && git merge origin/main This is how I resolved it; we should recommend this explicitly for fellow contributors.
5f8e106
to
71088c3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I recently went to merge a PR that had a merge conflict: $ gh pr merge --squash --delete-branch X Pull request llvm#66003 is not mergeable: the merge commit cannot be cleanly created. To have the pull request merged after all the requirements have been met, add the `--auto` flag. Run the following to resolve the merge conflicts locally: gh pr checkout 66003 && git fetch origin main && git merge origin/main This is how I resolved it; we should recommend this explicitly for fellow contributors.
I recently went to merge a PR that had a merge conflict:
This is how I resolved it; we should recommend this explicitly for
fellow contributors.