summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-git.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/init-git.el b/lisp/init-git.el
index d6b8344..45a6f0c 100644
--- a/lisp/init-git.el
+++ b/lisp/init-git.el
@@ -107,6 +107,12 @@ without requiring confirmation.
(magit-list-remote-branch-names))))
(magit-run-git "checkout" "-t" remote-branch))
+(defun km/magit-delete-previous-branch (&optional force)
+ "Delete previous branch.
+\n(git branch -d @{-1})"
+ (interactive "P")
+ (magit-run-git "branch" (if force "-D" "-d") "@{-1}"))
+
(defun km/magit-checkout-previous-branch ()
"Checkout previous branch.
\n(git checkout -)"
@@ -271,6 +277,9 @@ the commit buffer. And no dinging."
?c "Create & checkout from current"
'km/magit-branch-and-checkout-from-current)
(magit-define-popup-action 'magit-branch-popup
+ ?l "Delete previous branch"
+ 'km/magit-delete-previous-branch)
+ (magit-define-popup-action 'magit-branch-popup
?p "Checkout previous" 'km/magit-checkout-previous-branch)
(magit-define-popup-action 'magit-branch-popup
?m "Checkout master" 'km/magit-checkout-master)