diff options
-rw-r--r-- | init.el | 2 | ||||
-rw-r--r-- | lisp/km-magit.el | 10 |
2 files changed, 8 insertions, 4 deletions
@@ -1177,7 +1177,7 @@ '("d" "Copy branch" km/magit-branch-copy)) (transient-append-suffix 'magit-branch "r" - '("s" "Backup current branch" km/magit-branch-backup-current)) + '("s" "Backup current branch" km/magit-branch-checkpoint)) (transient-append-suffix 'magit-branch "c" '("m" "Checkout master" km/magit-checkout-master))) diff --git a/lisp/km-magit.el b/lisp/km-magit.el index 7f339cd..953b8f9 100644 --- a/lisp/km-magit.el +++ b/lisp/km-magit.el @@ -220,15 +220,15 @@ START-POINT set to the current branch. (error "bug: version re should always match")))) (km/magit-branch-get-set branch suffix))))) -(defun km/magit-branch-backup-current (&optional suffix) +(defun km/magit-branch-checkpoint (&optional suffix) "Create a backup branch for the current branch. -Name it as '<current-branch>__v<n>', where <n> is incremented +Name it as '<current-branch>__cp<n>', where <n> is incremented to form a refname that doesn't already exist. With the prefix argument SUFFIX, prompt for a suffix to use instead of 'v'." (interactive (list (and current-prefix-arg (magit-read-string-ns "Backup suffix")))) - (setq suffix (or suffix "v")) + (setq suffix (or suffix "cp")) (let* ((current (or (magit-get-current-branch) (user-error "No current branch"))) (versions (km/magit-branch--get-versions current suffix))) @@ -239,6 +239,10 @@ argument SUFFIX, prompt for a suffix to use instead of suffix (if (null versions) 1 (1+ (apply #'max versions))))))) +(defun km/magit-branch-version () + (interactive) + (km/magit-branch-checkpoint "v")) + (defun km/magit-branch-archive (branches) "Move BRANCHES from refs/heads/ to refs/archive/." (interactive |