summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-06-09 21:29:13 -0400
committerKyle Meyer <kyle@kyleam.com>2014-06-09 21:29:13 -0400
commitaad7a505c9b4c35afbdcd30928b16782899db8ca (patch)
tree1dc85bf9cd963eb18130fd2d8717524405dac10a
parent7c583f601213306c4617eb4c451de714909ada68 (diff)
downloademacs.d-aad7a505c9b4c35afbdcd30928b16782899db8ca.tar.gz
Add km/magit-backup-branch
-rw-r--r--lisp/init-git.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/init-git.el b/lisp/init-git.el
index 2e1ee30..5affb59 100644
--- a/lisp/init-git.el
+++ b/lisp/init-git.el
@@ -41,6 +41,14 @@ Useful for non-source code repos (e.g., Org mode note files)."
(magit-list-remote-branch-names))))
(magit-run-git "checkout" "-t" remote-branch))
+(defun km/magit-backup-branch ()
+ "Create a backup branch for the current branch.
+\(git branch b/<current-branch>\)"
+ (interactive)
+ (-if-let (current-branch (magit-get-current-branch))
+ (magit-run-git "branch" (concat "b/" current-branch))
+ (user-error "No current branch")))
+
(magit-define-popup-action 'magit-commit-popup
?u "Auto commit" 'km/magit-auto-commit)
(magit-define-popup-action 'magit-push-popup
@@ -49,6 +57,8 @@ Useful for non-source code repos (e.g., Org mode note files)."
?a "All branches" 'km/magit-log-all-branches)
(magit-define-popup-action 'magit-branch-popup
?t "Local tracking" 'km/magit-checkout-local-tracking)
+(magit-define-popup-action 'magit-branch-popup
+ ?s "Backup current branch" 'km/magit-backup-branch)
;; http://whattheemacsd.com/setup-magit.el-01.html
(defadvice magit-status (around magit-fullscreen activate)