Skip to content
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

Merged
merged 4 commits into from
Sep 13, 2023

Conversation

nickdesaulniers
Copy link
Member

I recently went to merge a PR that had a merge conflict:

$ gh pr merge --squash --delete-branch
X Pull request #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.


::

git push -f
Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in b86da6c

Copy link
Member Author

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)

llvm/docs/GitHub.rst Outdated Show resolved Hide resolved
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.
@nickdesaulniers
Copy link
Member Author

nickdesaulniers commented Sep 13, 2023

rebased to clear the failed presubmits due to 2ca4d13 which was fixed by ee643b7

Copy link
Collaborator

@tru tru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nickdesaulniers nickdesaulniers merged commit 102715a into llvm:main Sep 13, 2023
1 of 2 checks passed
@nickdesaulniers nickdesaulniers deleted the gh_docs branch September 13, 2023 21:03
ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this pull request Sep 19, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants