---
next_cursor: eyJzY29yZSI6MCwic2VxIjoxOTgzLCJzaW5jZSI6bnVsbCwidG9vbCI6ImR2YyIsInYiOjF9
has_more: false
next: https://sincecutoff.com/v1/changes.md?tool=dvc&score=0&cursor=eyJzY29yZSI6MCwic2VxIjoxOTgzLCJzaW5jZSI6bnVsbCwidG9vbCI6ImR2YyIsInYiOjF9
items: 1
---
# sincecutoff.com changes: dvc

## dvc gc supports --num with --all-branches (dvc, 2026-03-31)
Published 2026-10-19
- slug: dvc-gc-supports-num-with-all-branches-18f1d97354fc
- score: 0.95

How to use it:

When cleaning a shared cache, run `dvc gc` with `--all-branches --num <N>` to keep data referenced by the last N commits from each branch tip. Add `--projects <path>... --force` to preserve the union across the current project and listed projects without a confirmation prompt.

Examples:

```
dvc gc --all-branches --num 2 --projects <project-path>... --force
```

- why_it_matters: When garbage-collecting repositories whose branches share a cache, preserve the last N commits from each branch tip.
- sources: <https://github.com/treeverse/dvc/releases/tag/3.67.1>, <https://github.com/treeverse/dvc/pull/11013>, <https://doc.dvc.org/command-reference/gc>
- gotchas: "Version: 3.67.1"; "--all-branches (or -a) (required): Keep cached data referenced in all Git branches, as well as the workspace; with `--num`, select the last N commits from each branch tip."; "--num <num> (or -n <num>) (required): Keep cached data referenced in the last N commits from each selected revision root, as well as the workspace. Can be used with `--all-branches`."; "--projects <paths> (or -p <paths>): Specify one or more project paths whose data should be preserved when projects share a cache or remote; together with `--all-branches --num`, DVC preserves the union across the current and listed projects."; "--force (or -f): Force garbage collection and skip the confirmation prompt."; "Prerequisite: For shared-cache preservation, pass paths for the other DVC projects; ensure their relevant commits and branches have been pulled first."; "The shared-cache union behavior applies when `--projects` repositories share the same cache."

Next: https://sincecutoff.com/v1/changes.md?tool=dvc&score=0&cursor=eyJzY29yZSI6MCwic2VxIjoxOTgzLCJzaW5jZSI6bnVsbCwidG9vbCI6ImR2YyIsInYiOjF9
Save `next_cursor`; next visit, pass it to get only what was published since.
<!-- end of page -->
