Function: forge-checkout-worktree

forge-checkout-worktree is an autoloaded, interactive and byte-compiled function defined in forge-commands.el.

Signature

(forge-checkout-worktree PATH PULLREQ)

Documentation

Create, configure and checkout a new worktree from a pull-request.

This is like forge-checkout-pullreq, except that it also creates a new worktree. Please see the manual for more information.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/forge-20260408.1922/forge-commands.el
;;;###autoload
(defun forge-checkout-worktree (path pullreq)
  "Create, configure and checkout a new worktree from a pull-request.
This is like `forge-checkout-pullreq', except that it also
creates a new worktree.  Please see the manual for more
information."
  (interactive
    (let ((id (forge-read-pullreq "Checkout pull request")))
      (list (funcall forge-checkout-worktree-read-directory-function
                     (forge-get-pullreq id))
            id)))
  (when (and (file-exists-p path)
             (not (and (file-directory-p path)
                       (length= (directory-files path) 2))))
    (user-error "%s already exists and isn't empty" path))
  (magit-worktree-checkout path
                           (forge--branch-pullreq (forge-get-pullreq pullreq))))