diff options
author | Kyle Meyer <kyle@kyleam.com> | 2019-05-05 23:10:42 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2019-05-05 23:10:42 -0400 |
commit | 1d9789d1e9459b91f58dc2db960c2fa5ba5460da (patch) | |
tree | c07c9239c5bf5eb9c0cbc0d88013a93fcdfa582e | |
parent | 1102f94ddbb21b4cd94b36d89c5def80cf00bc51 (diff) | |
download | emacs.d-1d9789d1e9459b91f58dc2db960c2fa5ba5460da.tar.gz |
magit: Add command to copy branch
-rw-r--r-- | init.el | 4 | ||||
-rw-r--r-- | lisp/km-magit.el | 10 |
2 files changed, 12 insertions, 2 deletions
@@ -1157,8 +1157,8 @@ '("c" "Create & checkout from current" km/magit-branch-and-checkout-from-current)) - (transient-replace-suffix 'magit-branch "r" - '("r" "Rename branch" km/magit-branch-rename)) + (transient-append-suffix 'magit-branch "S" + '("d" "Copy branch" km/magit-branch-copy)) (transient-append-suffix 'magit-branch "r" '("s" "Backup current branch" km/magit-branch-backup-current)) diff --git a/lisp/km-magit.el b/lisp/km-magit.el index 8faceeb..e672ec8 100644 --- a/lisp/km-magit.el +++ b/lisp/km-magit.el @@ -158,6 +158,16 @@ namespace." (unless (string= old new) (magit-run-git "branch" (if force "-M" "-m") old new))) +(defun km/magit-branch-copy (old new &optional force) + (interactive + (let ((branch (magit-read-local-branch "Copy branch"))) + (list branch + (magit-read-string-ns (format "Copy branch '%s' to" branch) + branch) + current-prefix-arg))) + (unless (string= old new) + (magit-run-git "branch" (if force "-C" "-c") old new))) + (defun km/magit-checkout-master () "Check out master branch. \n(git checkout master)" |