Skip to content

[Feature] Worktree listing and management commands #18

@renekris

Description

@renekris

Problem Statement

Users cannot list, switch between, or clean up worktrees using ghwt. Must use workmux directly, which breaks workflow and limits ghwt's value.

Proposed Solution

Add list, switch, remove, and clean commands to ghwt CLI.

Implementation Steps:

  • Create commands/list.py with list_worktrees() function
  • Create commands/remove.py with remove_worktree() function
  • Create commands/switch.py with switch_worktree() function
  • Create commands/clean.py with clean_worktrees() function
  • Convert main.py to command group using @click.group()
  • Add status information to list command (active, inactive, missing, age)
  • Add --force flag to remove command
  • Add --older-than and --merged flags to clean command
  • Add --open-editor flag to switch command
  • Add --dry-run flag to clean command
  • Add tests for each new command
  • Update README with command examples

Alternative Approaches

  • Use native git worktree list (portability)
  • Add interactive TUI for worktree selection
  • Integrate with tmux/screen for terminal sessions

Area

  • Feature/CLI

Estimated Effort

  • Medium (1-2d)

Acceptance Criteria

  • ghwt list shows all worktrees with status
  • ghwt switch <branch> changes to worktree directory
  • ghwt remove <branch> deletes worktree with confirmation
  • ghwt clean --older-than 7d removes old worktrees
  • All commands have proper help text
  • Add tests for each new command
  • Document commands in README with examples

Related Issues

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions