summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-09-02 01:26:50 -0400
committerKyle Meyer <kyle@kyleam.com>2014-09-02 01:26:50 -0400
commitd12722f6fb07a459d0724848086a735d4cb628c9 (patch)
treeadc6478dc2428885ba5ce0b607056270db5f2ef3
parentf4b84e60ee02979be8d7ff01c97c849ccc96b2b0 (diff)
downloademacs.d-d12722f6fb07a459d0724848086a735d4cb628c9.tar.gz
Add magit-checkout-previous-branch
-rw-r--r--lisp/init-git.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/init-git.el b/lisp/init-git.el
index 9ffe6a5..c5bd7c0 100644
--- a/lisp/init-git.el
+++ b/lisp/init-git.el
@@ -40,6 +40,12 @@ 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-checkout-previous-branch ()
+ "Checkout previous branch.
+\n(git checkout -)"
+ (interactive)
+ (magit-run-git "checkout" "-"))
+
(defun km/magit-branch-and-checkout-from-current (branch)
"Create and checkout BRANCH at current branch.
This is equivalent to running `magit-branch-and-checkout' with
@@ -91,6 +97,8 @@ START-POINT set to the current branch.
(magit-define-popup-action 'magit-branch-popup
?c "Create & checkout from current"
'km/magit-branch-and-checkout-from-current)
+ (magit-define-popup-action 'magit-branch-popup
+ ?p "Checkout previous" 'km/magit-checkout-previous-branch)
(setq magit-branch-popup-defaults
(delete "--track" magit-branch-popup-defaults)))