#16578

`but branch delete` can't delete a local branch that isn't applied

Openoyobbebopened 3d ago

but branch delete only resolves branches in the workspace, so a branch that was unapplied (or never applied) can't be deleted with it:

$ but unapply A
$ but branch delete A
Error: Could not find branch: 'A'

The workaround is git branch -D A, which skips the oplog, so there is no snapshot to but undo.

The API already covers this case: but_api::branch::branch_remove, which Lite uses for "Delete Branch Reference", records an oplog snapshot and refuses GitButler's technical refs and branches checked out in another worktree.

Proposal: when an argument to but branch delete isn't a workspace branch but names an existing local branch, delete it with branch_remove_with_perm. Applied branches keep the current path.

Related: #9983

I have an implementation with tests and can open a PR if this direction works for you.

but 0.22.0, macOS

Activity

0

No activity yet.