                             (straight--get-call
                              "git" "checkout" branch)))))
                   ,(if ref
-                       `("R" ,(format (concat "Rebase HEAD onto branch %S "
-                                              "and fast-forward %S to HEAD")
-                                      branch branch)
+                       `("R" ,(format "Rebase branch %S onto %S" branch ref)
                          ,(lambda ()
-                            ;; If the rebase encounters a conflict, no
-                            ;; sweat: the possibility of a
-                            ;; fast-forward will be detected elsewhere
-                            ;; in this function the next time around.
-                            ;; But we might as well finish the job if
-                            ;; we can.
-                            (and (straight--check-call
-                                  "git" "rebase" branch)
-                                 (straight--get-call
-                                  "git" "reset" "--hard" ref-name))))
-                     `("R" ,(format "Rebase branch %S onto %S" branch ref)
+                            ;; Rebase might fail, don't throw on
+                            ;; error.
+                            (straight--check-call
+                             "git" "rebase" ref branch)))
+                     `("R" ,(format (concat "Rebase HEAD onto branch %S "
+                                            "and fast-forward %S to HEAD")
+                                    branch branch)
                        ,(lambda ()
-                          ;; Rebase might fail, don't throw on error.
-                          (straight--check-call
-                           "git" "rebase" ref branch))))))))))))))
+                          ;; If the rebase encounters a conflict, no
+                          ;; sweat: the possibility of a fast-forward
+                          ;; will be detected elsewhere in this
+                          ;; function the next time around. But we
+                          ;; might as well finish the job if we can.
+                          (and (straight--check-call
+                                "git" "rebase" branch)
+                               (straight--get-call
+                                "git" "reset" "--hard" ref-name)))))))))))))))
 
 (cl-defun straight-vc-git--pull-from-remote-raw (recipe remote remote-branch)
   "Using straight.el-style RECIPE, pull from REMOTE.

                      (straight--get-call
                       "git" "checkout" branch)))))
            ,@(unless (or ref-ahead-p ref-behind-p)
                `(("m" ,(format "Merge %S to branch %S" ref branch)
                   ,(lambda ()
                      (if ref
                          (straight--check-call
                           "git" "merge" ref)
                        (let ((orig-head
                               (straight--get-call
                                "git" "rev-parse" ref-name)))
                          (straight--get-call
                           "git" "checkout" branch)
                          ;; Merge might not succeed, so don't throw
                          ;; on error.
                          (straight--check-call
                           "git" "merge" orig-head)))))
                  ("r" ,(format "Reset branch %S to %S" branch ref)
                   ,(lambda ()
                      (straight--get-call
                       "git" "reset" "--hard" ref-name)))

          ;; confuse this syntax with the syntax of the
          ;; `straight-popup' macro.
          `(,@(when ref-ahead-p
                `(("f" ,(format "Fast-forward branch %S to %s"
                                branch quoted-ref-name)
                   ,(lambda ()
                      (straight--get-call
                       "git" "reset" "--hard" ref-name)))))
