Maintenance Commands
Keep your repository healthy with garbage collection, integrity checks, and configuration management. These commands help optimize storage and ensure data integrity.
| Command | Description | Usage |
|---|---|---|
| gc | Run garbage collection | dits gc [OPTIONS] |
| fsck | Verify repository integrity | dits fsck [OPTIONS] |
| repo-stats | Show repository statistics | dits repo-stats [OPTIONS] |
| inspect-file | Inspect file dedup stats | dits inspect-file <PATH> |
| config | Get and set configuration | dits config <KEY> [VALUE] |
dits gc
Run garbage collection to remove unreferenced objects and reclaim disk space. Dits automatically runs GC periodically, but you can trigger it manually.
Synopsis
dits gc [OPTIONS]Options
--aggressive Run aggressive GC (more thorough, slower)
--dry-run Show what would be collected without deleting
--prune <DATE> Prune objects older than date
--auto Run only if needed (based on heuristics)
--keep-packs Don't repack objects
--progress Show progress bar
-v, --verbose Show detailed outputExamples
# Run garbage collection
$ dits gc
Running garbage collection...
Scanning objects: 45,892
Finding unreferenced: 1,234 objects
Checking stale stashes: 3 expired
Cleanup:
Orphaned chunks: 1,200 (2.3 GB)
Expired stashes: 3 (45 MB)
Unreferenced trees: 34 (12 KB)
Reclaimed: 2.35 GB
Duration: 45s
# Dry run to preview
$ dits gc --dry-run
Would remove:
1,200 orphaned chunks (2.3 GB)
3 expired stashes (45 MB)
34 unreferenced trees (12 KB)
Total: 2.35 GB would be reclaimed
# Aggressive GC (after major deletions)
$ dits gc --aggressive
Running aggressive garbage collection...
Phase 1: Scanning all objects... done
Phase 2: Building reachability graph... done
Phase 3: Identifying unreferenced... done
Phase 4: Removing objects... done
Phase 5: Repacking remaining... done
Phase 6: Verifying integrity... done
Reclaimed: 5.6 GB
Duration: 8m 32s
# Prune objects older than 30 days
$ dits gc --prune 30d
Pruning objects older than 30 days...
Removed: 456 objects (890 MB)
# Auto GC (run only if needed)
$ dits gc --auto
Repository doesn't need GC yet.
(Run 'dits gc' to force)When to Run GC
Run garbage collection after: deleting large files, resetting branches, cleaning up old stashes, or whenever you want to reclaim disk space. Dits runs light GC automatically, but manual runs can be more thorough.
dits fsck
Verify repository integrity. Checks that all objects are valid, properly linked, and not corrupted.
Synopsis
dits fsck [OPTIONS]Options
--full Full verification (verify all chunk hashes)
--strict Strict mode (treat warnings as errors)
--repair Attempt to repair issues
--progress Show progress bar
--json Output as JSON
-v, --verbose Show all checks, not just issuesExamples
# Quick integrity check
$ dits fsck
Checking repository integrity...
Commits: 567 checked
Trees: 1,234 checked
Assets: 156 checked
Chunks: 45,892 checked (metadata only)
References: 12 checked
Repository is healthy.
# Full verification (slow but thorough)
$ dits fsck --full
Checking repository integrity (full mode)...
Commits: 567 ████████████████████ 100%
Trees: 1,234 ████████████████████ 100%
Assets: 156 ████████████████████ 100%
Chunks: 45,892 ████████████████████ 100%
Verifying hashes: 45,892 of 45,892
All objects verified.
Repository is healthy.
Duration: 12m 45s
# Check with repair
$ dits fsck --repair
Checking repository integrity...
✓ Commits: 567 OK
✓ Trees: 1,234 OK
✗ Assets: 1 issue found
- footage/corrupted.mov: missing chunk abc1234
✓ Chunks: 45,891 OK
Repair options:
1. Re-fetch missing chunk from remote
2. Remove reference to corrupted file
3. Skip (manual repair later)
Select option [1]: 1
Fetching chunk abc1234 from origin... done
Repair complete.
# Strict mode (for CI/CD)
$ dits fsck --strict
Exit code: 0 # All checks passedWhat fsck Checks
| Check | Description | Mode |
|---|---|---|
| Object existence | All referenced objects exist | Quick |
| Reference validity | Refs point to valid commits | Quick |
| Commit chain | Parent commits exist and form valid DAG | Quick |
| Tree entries | Trees reference valid assets | Quick |
| Asset manifests | Assets reference valid chunks | Quick |
| Chunk hashes | Chunk content matches hash | Full only |
dits repo-stats
Show detailed repository statistics including deduplication efficiency, storage usage, and file breakdown.
Synopsis
dits repo-stats [OPTIONS]Options
-v, --verbose Show per-file breakdown
--json Output as JSON
--format <FMT> Output format (table, json)Examples
$ dits repo-stats
Repository Statistics (commit abc1234)
Branch: main
Commit: abc1234def5
Message: Add footage for episode 2
Files:
Tracked files: 156
Total size: 128.00 GiB (logical)
Storage:
Physical size: 87.30 GiB (actual storage used)
Pack files: 12 (42 GiB)
Loose objects: 4,567 (45.3 GiB)
Deduplication:
Unique chunks: 93,542
Total chunks: 145,678
Chunk reuse: 35.8%
Space saved: 40.70 GiB (31.8%)
Dedup ratio: 0.682 (physical / logical, lower is better)
Analysis:
✓ Good deduplication. Significant chunk reuse detected.
# Verbose with per-file breakdown
$ dits repo-stats -v
Per-File Breakdown:
Path Size Chunks Type Unique
─────────────────────────────────────────────────────────────────────
footage/scene01.mov 10.0 GiB 10,240 MP4 2%
footage/scene02.mov 12.3 GiB 12,595 MP4 5%
footage/scene01_v2.mov 10.2 GiB 10,445 MP4 98% shared with scene01.mov
project.prproj 2.1 MiB 3 file 100%
...
Most Deduplicated Files:
footage/scene01_v2.mov - 98% shared with other files
footage/interview_b.mov - 95% shared with other files
...dits inspect-file
Inspect a specific file's chunk structure and deduplication statistics.
Synopsis
dits inspect-file [OPTIONS] <PATH>Options
--chunks List all chunk hashes
--shared Show which files share chunks
--json Output as JSONExamples
$ dits inspect-file footage/scene01.mov
Inspecting: footage/scene01.mov
File Information:
Path: footage/scene01.mov
Commit: abc1234def5
Manifest: 9e21c38bbf5
Content hash: 8d92f0e4a1b
Type: MP4 (structure-aware)
Size:
Logical size: 10.00 GiB
Estimated unique size: 208.00 MiB
Chunk Breakdown:
Total chunks: 10,240
Shared chunks: 10,032 (98.0%)
Unique chunks: 208 (2.0%)
Deduplication Analysis:
This file shares 10,032 chunks with other files in the repo.
Estimated storage savings: 9.79 GiB
# See which files share chunks
$ dits inspect-file --shared footage/scene01_v2.mov
Shares chunks with:
footage/scene01.mov 9,856 chunks (96.2%)
footage/scene01_v3.mov 10,012 chunks (97.8%)dits config
Get and set repository configuration values. Configuration can be local (repo-specific) or global (user-wide).
Synopsis
dits config [OPTIONS] <KEY> [VALUE]Options
--global Use global config (~/.config/dits/config)
--local Use local config (.dits/config) - default
--system Use system config
--list List all config values
--unset Remove a config key
--edit Open config in editor
--get Get value (explicit)Examples
# Set user identity (global)
$ dits config --global user.name "John Editor"
$ dits config --global user.email "john@example.com"
# Get a config value
$ dits config user.email
john@example.com
# List all config
$ dits config --list
user.name=John Editor
user.email=john@example.com
core.editor=vim
remote.origin.url=https://dits.example.com/project
cache.size=10GB
...
# Set local config
$ dits config cache.size 50GB
# Unset a value
$ dits config --unset cache.size
# Edit config file
$ dits config --global --edit
# Opens ~/.config/dits/config in editorCommon Configuration Keys
| Key | Description | Default |
|---|---|---|
| user.name | Your name for commits | - |
| user.email | Your email for commits | - |
| core.editor | Editor for commit messages | $EDITOR |
| cache.size | Local cache size limit | 10GB |
| push.default | Default push behavior | current |
| gc.auto | Auto GC threshold | 6700 |
| chunk.minSize | Minimum chunk size | 256KB |
| chunk.avgSize | Target average chunk size | 1MB |
Related Commands
- Storage Commands - Manage storage tiers
- Video Commands - File inspection
- Configuration - Full config reference