MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / RemoveWorktree

Function RemoveWorktree

internal/git/worktree.go:100–107  ·  view source on GitHub ↗

RemoveWorktree removes a git worktree at the given path.

(repoDir, worktreePath string)

Source from the content-addressed store, hash-verified

98
99// RemoveWorktree removes a git worktree at the given path.
100func 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.
110func ListWorktrees(repoDir string) ([]Worktree, error) {

Callers 4

cleanupWorktreeSetupMethod · 0.92
CreateWorktreeFunction · 0.85
TestRemoveWorktreeFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestRemoveWorktreeFunction · 0.68