summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-05-28 23:04:27 -0400
committerKyle Meyer <kyle@kyleam.com>2014-05-28 23:04:27 -0400
commitcb50140969f5f7567142395348adc9e88e51a738 (patch)
tree424ece89bad785115c6aaaa115af1a791ffce5c5
parent1879ffd461bac328bae0434edc246fe8b21d46f7 (diff)
downloademacs.d-cb50140969f5f7567142395348adc9e88e51a738.tar.gz
Add km/magit-checkout-local-tracking
-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 9ed94ad..bc7c70c 100644
--- a/lisp/init-git.el
+++ b/lisp/init-git.el
@@ -33,12 +33,22 @@ Useful for non-source code repos (e.g., Org mode note files)."
(add-to-list 'args "--all")
(magit-log-dwim range args))
+(defun km/magit-checkout-local-tracking (remote-branch)
+ "Create and checkout a local tracking branch for REMOTE-BRANCH.
+\(git checkout -t REMOTE-BRANCH\)"
+ (interactive
+ (list (magit-completing-read "Remote branch"
+ (magit-list-remote-branch-names))))
+ (magit-run-git "checkout" "-t" remote-branch))
+
(magit-define-popup-action 'magit-commit-popup
?u "Auto commit" 'km/magit-auto-commit)
(magit-define-popup-action 'magit-push-popup
?a "Push all" 'km/magit-push-all)
(magit-define-popup-action 'magit-log-popup
?a "All branches" 'km/magit-log-all-branches)
+(magit-define-popup-action 'magit-branch-popup
+ ?t "Local tracking" 'km/magit-checkout-local-tracking)
(diminish 'magit-auto-revert-mode)