> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ellomas.com/llms.txt
> Use this file to discover all available pages before exploring further.

# graft delete

> Delete a branch and its DAG records.

# `graft delete`

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

## Usage

```bash theme={null}
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

```bash theme={null}
graft delete experiment
```

```text theme={null}
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

| Code | Meaning                               |
| ---- | ------------------------------------- |
| `0`  | Branch deleted                        |
| `1`  | Error (is main, is active, not found) |
