summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-03-25 23:33:14 -0400
committerKyle Meyer <kyle@kyleam.com>2015-03-25 23:33:14 -0400
commit27e57ae520ecd760020f985a80395afe54f12f69 (patch)
treebe86bfe01d73666758c4c2bafac12c69acbc7831 /lisp
parentbe48b45670a667b7811e9e8c3ac1db6d54ad2be4 (diff)
downloademacs.d-27e57ae520ecd760020f985a80395afe54f12f69.tar.gz
Add magit-delete-previous-branch command
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)