summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2019-06-27 20:13:24 -0400
committerKyle Meyer <kyle@kyleam.com>2019-08-10 22:30:29 -0400
commitff7387c18860e54c28a19cb08b5adeba8a64a193 (patch)
treee5bb1b6a69b40174b48010aae5e2f3ae4654c780
parentb2b47cfbfd6107c784c4a752ace17c321a7a467d (diff)
downloademacs.d-ff7387c18860e54c28a19cb08b5adeba8a64a193.tar.gz
magit: Add command for doing fast-forward merge of push branch
-rw-r--r--init.el5
-rw-r--r--lisp/km-magit.el8
2 files changed, 13 insertions, 0 deletions
diff --git a/init.el b/init.el
index 31bcb75..81f5291 100644
--- a/init.el
+++ b/init.el
@@ -1005,6 +1005,8 @@
(transient-suffix-put 'magit-push "u" :key "U")
(transient-suffix-put 'magit-push "p" :key "P")
+ (transient-suffix-put 'magit-merge "p" :key "P")
+
(setf (alist-get 'magit-show-refs transient-values)
(list "--sort=-committerdate"))
@@ -1152,6 +1154,9 @@
(transient-append-suffix 'magit-merge "m"
'("u" "Merge upstream" km/magit-ff-merge-upstream))
+ (transient-append-suffix 'magit-merge "u"
+ '("p" "Merge push" km/magit-ff-merge-push))
+
(transient-append-suffix 'magit-branch "b"
'("c" "Create & checkout from current"
km/magit-branch-and-checkout-from-current))
diff --git a/lisp/km-magit.el b/lisp/km-magit.el
index e672ec8..b16c49b 100644
--- a/lisp/km-magit.el
+++ b/lisp/km-magit.el
@@ -125,6 +125,14 @@ branch."
(magit-merge-plain it '("--ff-only"))
(user-error "No upstream branch")))
+(defun km/magit-ff-merge-push ()
+ "Perform a fast-forward merge of the push branch.
+\n(git merge --no-edit --ff-only <push>)"
+ (interactive)
+ (--if-let (magit-get-push-branch)
+ (magit-merge-plain it '("--ff-only"))
+ (user-error "No push branch")))
+
;;;###autoload
(defun km/magit-merge-pull-message (rev)
"Generate a PR merge message for REV.