Skip to content

[ghcp-handoff] T6: Add worktree gc subcommand for merged branches #20

@bminier

Description

@bminier

Problem

`ghcp-worktree.ts` has `add` and `remove` but no garbage collection. Over time `.gstack/worktrees/` accumulates directories for branches that are already merged to main.

Approach

`bun run bin/ghcp-worktree.ts gc`:

  • List worktrees in `.gstack/worktrees/*`
  • For each, check whether its branch is merged into the default branch OR whether its PR is closed/merged (via `gh`)
  • Remove worktrees whose branches are safely mergeable

Dry-run by default; `--force` to actually remove.

Part of the G8 management story.

Review reference

Adversarial review T6

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestghcp-handoffRelates to /ghcp-handoff skill

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions