---
# System prepended metadata

title: 20220106_ostree-prune-examples

---

# 20220106_ostree-prune-examples

example:

```
ostree prune --refs-only --keep-younger-than='90 days ago' --only-branch fedora/{arch}/coreos/{stream}
```
- --refs-only
    - compute reachability only via refs
- --keep-younger-than='90 
    - delete any commits older than 90 days
- --only-branch=
    - only prune from history of given branch

Prune any commits and objects that are older than 90 days from the given branch



example:

```
ostree prune --commit-only --refs-only --keep-younger-than='90 days ago' --only-branch fedora/{arch}/coreos/{stream}
```

Prune any commits ~~and objects~~ that are older than 90 days from the given branch


example:

```
ostree prune --refs-only
```

Delete any objects from the repo that aren't reachable from a branch


example:

```
ostree prune --delete-commit=abcd 
```

Delete commit=abcd and any freed objects from the repo 

example:

```
ostree prune --commit-only --delete-commit=abcd 
```

Delete commit=abcd. Don't delete any freed objects

example:

```
ostree prune --refs-only --depth=10 -only-branch fedora/{arch}/coreos/{stream}
```
- --refs-only
    - compute reachability only via refs
- --depth=10
    - keep only last 10 commits in history of given branch
- --only-branch=
    - only prune from history of given branch

Prune any commits and objects that are beyond depth=10 for the given branch

