Skip to content

feat: undo last deletion — restore recently-removed worktree #63

Description

@sauravpanda

Problem

clean, prune, rm all permanently delete worktrees. If a user confirms by mistake (or the heuristic was wrong), the work is gone — they'd have to re-clone, re-create the branch, and lose any uncommitted local changes.

The existing snapshot command helps but requires prior action.

Suggested fix

  • Before removing, automatically archive a lightweight snapshot of uncommitted changes (reuse the snapshot plumbing) to ~/.bonsai/trash/<timestamp>-<branch>/.
  • Add bonsai undo to restore the most recent trashed worktree.
  • Add bonsai trash list / bonsai trash empty for management.
  • Trash entries auto-expire after N days (config-driven).

Optional: make this opt-in via --keep-history initially, opt-out later once stable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions