From 4da0bef75120ddbee64f6d80b4ead18d3dde2b3f Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 10 Oct 2019 18:24:56 -0400 Subject: magit: Add "checkout detached" command --- lisp/km-magit.el | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lisp') diff --git a/lisp/km-magit.el b/lisp/km-magit.el index 038e7d6..a04a15a 100644 --- a/lisp/km-magit.el +++ b/lisp/km-magit.el @@ -191,6 +191,11 @@ namespace." (interactive) (magit-run-git "checkout" "master")) +(defun km/magit-checkout-detached (branch) + "Check out commit pointed to by BRANCH." + (interactive (list (magit-read-branch "Branch"))) + (magit-run-git "checkout" (concat branch "^0"))) + (defun km/magit-branch-and-checkout-from-current (branch) "Create and check out BRANCH at the current branch. This is equivalent to running `magit-branch-and-checkout' with -- cgit v1.2.3