Skip to content

Extend camp fresh for stacked PR branch/worktree cleanup #307

Description

@lancekrogers

Problem

camp fresh is useful for starting a fresh branch, but stacked PR cleanup currently takes several manual steps after child PRs are merged into an aggregate branch.

Example from CW0003: PRs 303, 304, and 305 were merged into the PR 302 branch. After that, agents still had to manually identify and remove the stale child worktrees while keeping the PR 302 aggregate worktree.

Proposal

Add a camp fresh mode for switching to an existing target branch and cleaning up related stacked-PR branches/worktrees.

Possible UX:

camp fresh feat/workflow-surface-CW0003 --cleanup-stack
camp fresh --branch feat/workflow-surface-CW0003 --cleanup-stack

Expected behavior:

  • Switch or prepare the selected branch/worktree as the active working target.
  • Discover related project worktrees/branches for the stack.
  • Remove stale child worktrees once their branches have been merged into the selected branch.
  • Optionally prune local child branches that are merged and no longer checked out.
  • Refuse cleanup for dirty, unpushed, or unmerged worktrees unless an explicit force flag is provided.
  • Provide a dry-run/plan output before destructive cleanup.

Acceptance criteria

  • camp fresh can target an existing branch without implying a new branch should be created.
  • A stack cleanup option can safely remove merged child worktrees while preserving the selected target branch/worktree.
  • Dirty or unmerged worktrees are reported and skipped by default.
  • The command output clearly lists what will be kept, removed, and skipped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions