Function: magit-worktree-checkout
magit-worktree-checkout is an interactive and natively compiled
function defined in magit-worktree.el.
Signature
(magit-worktree-checkout DIRECTORY COMMIT)
Documentation
Checkout COMMIT in a new worktree in DIRECTORY.
COMMIT may, but does not have to be, a local branch.
Interactively, use magit-read-worktree-directory-function.
Key Bindings
This command is not in any keymaps.
Source Code
;; Defined in /nix/store/irvbdy0zra0dn8fpd008f32x5ix6qm5v-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-20261005.508/magit-worktree.el
;;;###autoload
(defun magit-worktree-checkout (directory commit)
"Checkout COMMIT in a new worktree in DIRECTORY.
COMMIT may, but does not have to be, a local branch.
Interactively, use `magit-read-worktree-directory-function'."
(interactive
(let ((commit (magit-read-branch-or-commit
"In new worktree; checkout" nil
(mapcar #'caddr (magit-list-worktrees)))))
(list (magit--read-worktree-directory commit)
commit)))
(when (zerop (magit-run-git "worktree" "add"
(magit--expand-worktree directory) commit))
(magit-diff-visit-directory directory)))