RemoveWorktree removes a git worktree at the given path.
(repoDir, worktreePath string)
| 98 | |
| 99 | // RemoveWorktree removes a git worktree at the given path. |
| 100 | func RemoveWorktree(repoDir, worktreePath string) error { |
| 101 | cmd := exec.Command("git", "worktree", "remove", worktreePath) |
| 102 | cmd.Dir = repoDir |
| 103 | if out, err := cmd.CombinedOutput(); err != nil { |
| 104 | return fmt.Errorf("failed to remove worktree: %s", strings.TrimSpace(string(out))) |
| 105 | } |
| 106 | return nil |
| 107 | } |
| 108 | |
| 109 | // ListWorktrees parses `git worktree list --porcelain` and returns all worktrees. |
| 110 | func ListWorktrees(repoDir string) ([]Worktree, error) { |
no outgoing calls