Function: projectile-worktrees-from-git
projectile-worktrees-from-git is a byte-compiled function defined in
projectile.el.
Signature
(projectile-worktrees-from-git ROOT)
Documentation
Return the git worktrees of the project at ROOT.
Git registers them itself, so this finds worktrees that have never been visited in this Emacs session - which the known projects can't do.
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile-worktrees-from-git (root)
"Return the git worktrees of the project at ROOT.
Git registers them itself, so this finds worktrees that have never been
visited in this Emacs session - which the known projects can't do."
(when-let* (((eq (projectile-project-vcs root) 'git))
((not (file-remote-p root)))
;; Only a checkout's own top level has worktrees. ROOT can
;; just as well be a directory *inside* one - a project marked
;; out by its own `.projectile' in a corner of a bigger
;; repository, say, which `projectile-project-vcs' still calls
;; git because it walks up to find the repository. Git would
;; happily list the enclosing repository's worktrees, but none
;; of them is another copy of *this* project.
((projectile--git-dir root))
(output (projectile--git root "worktree" "list" "--porcelain")))
(projectile--parse-git-worktree-list output)))