Linux command
dvc-gc 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Clean cache keeping
dvc gc -w
Clean keeping all
dvc gc -a
Clean keeping all
dvc gc -a -T
Dry run
dvc gc -w --dry
Force clean
dvc gc -w -c -f
Clean keeping data from the last
dvc gc -n [5]
说明
dvc gc removes unused files from the DVC cache, freeing disk space. At least one scope option (-w, -a, -T, -A, --all-experiments, -n, --rev, or --date) must be specified to define which data to keep. The cache accumulates files from all tracked versions. Garbage collection identifies and removes files no longer referenced by any specified commits, branches, or tags. The cloud option (-c) extends cleaning to remote storage, removing files not needed by the specified scope.
参数
- -w, --workspace
- Keep files used in current workspace.
- -a, --all-branches
- Keep files used in all Git branch tips.
- -T, --all-tags
- Keep files used in all Git tags.
- -A, --all-commits
- Keep files used in all Git commits.
- --all-experiments
- Keep files used in all experiments.
- -c, --cloud
- Also garbage collect in remote storage in addition to local cache.
- -r _NAME_, --remote _NAME_
- Target a specific remote for garbage collection.
- -n _NUM_, --num _NUM_
- Keep data from the last NUM commits (default: 1).
- --rev _COMMIT_
- Keep data files from a specified Git commit.
- --date _YYYY-MM-DD_
- Keep cached data from commits after the specified date.
- --not-in-remote
- Keep data not present in remote storage.
- -f, --force
- Skip confirmation prompts.
- -j _NUM_, --jobs _NUM_
- Number of concurrent jobs for cloud operations.
- --dry
- Preview what would be deleted without executing.
- -p _PATHS_, --projects _PATHS_
- Include specified projects when sharing a cache directory.
FAQ
What is the dvc-gc command used for?
dvc gc removes unused files from the DVC cache, freeing disk space. At least one scope option (-w, -a, -T, -A, --all-experiments, -n, --rev, or --date) must be specified to define which data to keep. The cache accumulates files from all tracked versions. Garbage collection identifies and removes files no longer referenced by any specified commits, branches, or tags. The cloud option (-c) extends cleaning to remote storage, removing files not needed by the specified scope.
How do I run a basic dvc-gc example?
Run `dvc gc -w` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -w, --workspace do in dvc-gc?
Keep files used in current workspace.