diff options
author | Kyle Meyer <kyle@kyleam.com> | 2015-12-06 23:58:05 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2015-12-06 23:58:05 -0500 |
commit | 9c7b4e3ba6133d61e5de6649808daa3c14de41ec (patch) | |
tree | 3d984417eaebada51056674db2c0cbd29895acf2 /lisp | |
parent | 886ef58878a3650a1c07ab418cbff1e2d2cb1c8f (diff) | |
download | emacs.d-9c7b4e3ba6133d61e5de6649808daa3c14de41ec.tar.gz |
Add custom magit-branch-rename command
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/init-git.el | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lisp/init-git.el b/lisp/init-git.el index 69dc888..c9bd73c 100644 --- a/lisp/init-git.el +++ b/lisp/init-git.el @@ -149,6 +149,17 @@ without requiring confirmation. branches)))))) (magit-run-git "checkout" "-t" remote-branch)) +(defun km/magit-branch-rename (old new &optional force) + "Like `magit-branch-rename', but use old branch as initial prompt." + (interactive + (let ((branch (magit-read-local-branch "Rename branch"))) + (list branch + (magit-read-string-ns (format "Rename branch '%s' to" branch) + branch) + current-prefix-arg))) + (unless (string= old new) + (magit-run-git-no-revert "branch" (if force "-M" "-m") old new))) + (defun km/magit-delete-previous-branch (&optional force) "Delete previous branch. \n(git branch -d @{-1})" @@ -661,6 +672,8 @@ show tags by default." (magit-define-popup-action 'magit-branch-popup ?p "Checkout previous" 'km/magit-checkout-previous-branch) (magit-define-popup-action 'magit-branch-popup + ?r "Rename branch" 'km/magit-branch-rename) +(magit-define-popup-action 'magit-branch-popup ?s "Backup current branch" 'km/magit-backup-branch) (magit-define-popup-action 'magit-branch-popup ?t "Local tracking" 'km/magit-checkout-local-tracking) |