Skip to content

Add separate delete options: workflow+branch, workflow only, branch only #8

@nsheaps

Description

@nsheaps

Description

Provide separate delete options for more granular control:

  1. Delete worktree + branch - Current behavior, removes both
  2. Delete worktree only - Remove the worktree but keep the branch
  3. Delete branch only - Available when not on a worktree, removes just the branch

Use Cases

  • Keep branch for later work while cleaning up disk space (worktree only)
  • Clean up merged branches without worktrees (branch only)
  • Full cleanup when done with feature (both)

CLI / Non-TTY Mode Context

When running in non-interactive (non-TTY) environments or via CLI arguments, delete behavior changes:

CLI Usage

git-wt d <branch>      # Delete worktree+branch (requires --force in non-interactive)
git-wt d <branch> --force  # Force delete without confirmation

Behavior

  • Interactive mode: Shows gum confirmation prompt before deletion
  • Non-interactive mode: Requires --force flag, otherwise fails with error
  • If branch has no worktree, git-wt d fails with an error

Related to Non-TTY Mode

The delete command is part of the broader CLI argument support:

  • git-wt [branch] - Switch to/create worktree (prints path by default)
  • git-wt d [branch] - Delete worktree+branch
  • --exec flag spawns new shell instead of just printing path
  • --force flag for non-interactive deletion

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