Let’s say I’m inside a Git repo with worktrees. Given a branch name, how can I find out if this branch is checked out in a worktree, and if so, the path to this worktree?
P.S. this is for a script, I know I could parse the output of git worktree list
, but I’d prefer a solution using git rev-parse
or similar.