Spheroman / Spheroman/newgit

`remove` destroys the workspace, containers and volume, but keeps the source branch

Open
#82 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
0
Forks
0
Avg merge
1h 58m
Merged PRs (30d)
48

Description

Summary

newgit remove deletes the workspace, runs every [cleanup] hook (for me:
containers and a Docker volume), and archives the binding record — then keeps
the source branch and tells you to delete it yourself.

The asymmetry is inverted: it destroys the expensive, irrecoverable things
automatically and preserves the cheapest, most recoverable one manually.

What happens

$ newgit remove feature/ng-smoke
  cleanup:  infra ran `... mise run db:destroy` ok      # container + volume, gone
  workspace: /Users/.../feature-ng-smoke (deleted)       # gone
  record:    archived at .newgit/branches/archived/...
  source branch `feature/ng-smoke` kept in the store; delete with
  `git branch -D feature/ng-smoke` if unwanted

crates/newgit/src/main.rs:1785.

Why this matters

Iterating on resource definitions means spawning and removing repeatedly. Every
cycle became:

newgit remove feature/ng-smoke
git branch -D feature/ng-smoke     # every single time

and forgetting the second line makes the next newgit spawn feature/ng-smoke
behave differently, because the branch already exists. During this integration
I spawned and removed the same instance name four times and ran git branch -D
four times.

I do understand the conservatism — a branch may hold commits that exist nowhere
else, and remove should not eat work. But that argument applies far more
strongly to the workspace (uncommitted changes) and the volume (a database that
took a catalog mirror to populate), and remove takes both without asking.

Suggested fix

A flag, defaulting to current behaviour:

newgit remove <instance> --branch          # delete the source branch too
newgit remove <instance> --branch=if-merged

--branch=if-merged is the one I would reach for: safe by construction, and it
covers the common case where the work already landed via a pull request and the
branch is pure residue.

Alternatively, make the existing message actionable rather than instructional —
report whether the branch is merged, so the reader knows which answer applies
without going to look:

source branch `feature/ng-smoke` kept (merged into develop) — delete with
`git branch -d feature/ng-smoke`

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at crates/newgit/src/main.rs:1785 and trace the newgit remove command's source-branch handling alongside workspace cleanup and record archiving. Clarify the intended flag behavior, including the proposed --branch and --branch=if-merged cases, then verify removal with branches that are merged and unmerged. Done means the selected branch behavior is explicit and the existing default remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.