Function: magit-worktree-branch

magit-worktree-branch is an interactive and natively 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

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-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)
            branch start-point)))
  (when (zerop (magit-run-git "worktree" "add" "-b" branch
                              (magit--expand-worktree directory) start-point))
    (magit-diff-visit-directory directory)))