From ff7387c18860e54c28a19cb08b5adeba8a64a193 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 27 Jun 2019 20:13:24 -0400 Subject: magit: Add command for doing fast-forward merge of push branch --- init.el | 5 +++++ lisp/km-magit.el | 8 ++++++++ 2 files changed, 13 insertions(+) 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 )" + (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. -- cgit v1.2.3