Function: magit-worktree-branch

magit-worktree-branch is an autoloaded, interactive and byte-compiled function defined in magit-worktree.el.

Signature

(magit-worktree-branch DIRECTORY BRANCH START-POINT)

Documentation

Create a new BRANCH and check it out in a new worktree at DIRECTORY.

Interactively, use magit-read-worktree-directory-function.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-worktree.el
;;;###autoload
(defun magit-worktree-branch (directory branch start-point)
  "Create a new BRANCH and check it out in a new worktree at DIRECTORY.
Interactively, use `magit-read-worktree-directory-function'."
  (interactive
    (pcase-let
        ((`(,branch ,start-point)
          (magit-branch-read-args "In new worktree; checkout new branch")))
      (list (magit--read-worktree-directory branch t)
            branch start-point)))
  (when (zerop (magit-run-git "worktree" "add" "-b" branch
                              (magit--expand-worktree directory) start-point))
    (magit-diff-visit-directory directory)))