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

# prune

> List, add, edit, or remove revision-limit rules for a repository (organization admins only).

The `prune` command manages **revision-limit rules**: per-pattern rules that keep only the latest N versions of matching files and prune older ones. For the concepts, branch-safe counting, and glob syntax, see the [Revision Limits guide](/advanced/revision-limits).

<Warning>
  Pruning permanently deletes older file versions and cannot be undone. It runs automatically after every commit, with no prompt. Check a repo's rules with `dv prune list` before you rely on them.
</Warning>

Requirements:

* You must be an [**organization admin**](/basic/access-levels#organization-level-access).
* Revision limits are not supported on repositories synced with Git.

Rules are an ordered list. When more than one rule matches a path, the **last matching rule wins**. Adding a rule appends it to the end (highest priority). Each rule has a server-assigned `id` that `list` prints and that `set` / `remove` take.

## list

Show every rule, in priority order.

```bash theme={null}
dv prune list
```

Prints an `ID`, `PATTERN`, and `KEEP` column per rule. `KEEP` is a number, or `all` for a rule that keeps every version. With no rules, it prints `No retention rules configured.`

`list` is the default subcommand -- plain `dv prune` does the same thing.

## add

Add a rule.

```bash theme={null}
dv prune add <pattern> --keep <N|all>
```

`<pattern>` is a repo-root-anchored glob (e.g. `/Assets/....psd`). Quote it so your shell does not expand the wildcards. See [glob syntax](/advanced/revision-limits#glob-syntax).

`--keep` is required:

* `<N>` -- keep the latest `N` versions (`1` to `999`).
* `all` -- keep every version (never prune). Use it to carve a path out of a broader limit.

The new rule is appended, so it takes priority over earlier matching rules.

Example:

```bash theme={null}
dv prune add "/....pak" --keep 1
dv prune add "/Assets/Textures/....exr" --keep 3
```

## set

Edit a rule by id.

```bash theme={null}
dv prune set <id> [--keep <N|all>] [--pattern <pattern>]
```

`<id>` is a rule id from `dv prune list`. Pass `--keep`, `--pattern`, or both -- at least one is required.

Example:

```bash theme={null}
dv prune set r_3f2a --keep 5
dv prune set r_3f2a --pattern "/Assets/....psd"
```

## remove

Delete a rule by id.

```bash theme={null}
dv prune remove <id>
```

Example:

```bash theme={null}
dv prune remove r_3f2a
```

## Notes

* Adding a rule applies it to **future** commits. It does not prune versions that already exceed the new limit; those are pruned as later commits touch each matching file.
* Pruning runs in the background after each commit and is silent for the committer.

For the full conceptual guide and Perforce `+S` migration, see [Revision Limits](/advanced/revision-limits).
