pub fn create_worktree<P: AsRef<Path>>(path: P, branch: &str) -> Result<()>Expand description
Create a new worktree at the specified path for the given branch.
If the branch already exists, it will be checked out in the new worktree. If the branch doesn’t exist, it will be created from the current HEAD.
§Arguments
path- The path where the worktree should be createdbranch- The branch name to checkout or create
§Returns
Ok(())- Worktree created successfullyErr- If creation fails (e.g., branch already checked out elsewhere)