Skip to main content

graft delete

Delete a branch, removing its DAG commits, tree entries, ref, and branch directory.

Usage

graft delete <branch>

Behavior

  1. Drop the branch ref from SQLite
  2. Delete all commits belonging to the branch
  3. Delete all tree entries for those commits
  4. Remove the branch directory from ~/.graft/<project>/branches/<name>/
  5. Remove the branch from the state file

Examples

graft delete experiment
Deleting branch directory ~/.graft/my-postgres/branches/experiment...
Branch experiment deleted. Object-pool blobs retained (gc in Step 11).

Notes

  • Cannot delete the main branch
  • Cannot delete the currently active branch — switch to another branch first
  • Object pool blobs are not removed (they may be shared with other branches). A future graft gc command will prune orphan blobs.
  • The branch’s DAG history is permanently removed

Exit Codes

CodeMeaning
0Branch deleted
1Error (is main, is active, not found)