[llvm] [Docs][Github] explain how to rectify gh pr merge failure (PR #66223)

Nick Desaulniers via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 09:09:57 PDT 2023


================
@@ -131,6 +131,33 @@ You can also merge via the CLI by switching to your branch locally and run:
 
   gh pr merge --squash --delete-branch
 
+If you observe an error message from the above informing you that your pull
+request is not mergeable, then that is likely because upstream has been
+modified since your pull request was authored in a way that now results in a
+merge conflict. You must first resolve this merge conflict in order to merge
+your pull request. In order to do that:
+
+::
+
+  git fetch origin
+  git rebase origin/main
+
+Then fix the source files causing merge conflicts.
+
+::
+
+  git add <files with resolved merge conflicts>
+  <rebuild + retest>
+  git rebase --continue
+
+Finally, you'll need to force push to your branch one more time before you can
+merge:
+
+::
+
+  git push -f
----------------
nickdesaulniers wrote:

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)

https://github.com/llvm/llvm-project/pull/66223


More information about the llvm-commits mailing list