diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-09-02 01:26:50 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-09-02 01:26:50 -0400 |
commit | d12722f6fb07a459d0724848086a735d4cb628c9 (patch) | |
tree | adc6478dc2428885ba5ce0b607056270db5f2ef3 /lisp | |
parent | f4b84e60ee02979be8d7ff01c97c849ccc96b2b0 (diff) | |
download | emacs.d-d12722f6fb07a459d0724848086a735d4cb628c9.tar.gz |
Add magit-checkout-previous-branch
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/init-git.el | 8 |
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))) |