Function
create_worktree
(
path: str,
branch: str | None = None,
cwd: str | None = None,
*,
new_branch: bool = False,
)
Source from the content-addressed store, hash-verified
| 345 | |
| 346 | |
| 347 | def create_worktree( |
| 348 | path: str, |
| 349 | branch: str | None = None, |
| 350 | cwd: str | None = None, |
| 351 | *, |
| 352 | new_branch: bool = False, |
| 353 | ) -> bool: |
| 354 | args = ["worktree", "add"] |
| 355 | if new_branch and branch: |
| 356 | args.extend(["-b", branch, path]) |
| 357 | elif branch: |
| 358 | args.extend([path, branch]) |
| 359 | else: |
| 360 | args.append(path) |
| 361 | |
| 362 | _, _, rc = _run_git(args, cwd) |
| 363 | return rc == 0 |
| 364 | |
| 365 | |
| 366 | def remove_worktree( |
Callers
nothing calls this directly
Tested by
no test coverage detected