Usage
latest as an alias for the most recent snapshot.
Arguments
First snapshot to compare. Can be:
- Full snapshot hash (e.g.,
a3f8d2e1...) - Short prefix (e.g.,
a3f8d2) latest— the most recent snapshot
Second snapshot to compare. Can be:
- Full snapshot hash (e.g.,
b1e9c7d3...) - Short prefix (e.g.,
b1e9c7) latest— the most recent snapshot
Options
Global Options
- Storage backend configuration (
-store,-store-path, etc.) - Encryption credentials (
-encryption-password,-encryption-key, etc.) - Verbosity flags (
-verbose,-quiet,-debug)
Enable verbose output showing detailed information about the diff operation, including unchanged files.
Examples
Output
The command displays a list of changed files with change types:Change Types
- added — File exists in snapshot 2 but not in snapshot 1
- modified — File exists in both snapshots but content changed
- removed — File exists in snapshot 1 but not in snapshot 2
The diff is directional:
diff A B shows changes going from A to B. To see the reverse, swap the arguments: diff B A.How It Works
Cloudstic compares snapshots efficiently using content addressing:- Load both snapshot objects to get their HAMT root nodes
- Traverse both HAMT trees in parallel
- Compare file metadata refs (content hashes)
- Files with the same ref are identical (unchanged)
- Files with different refs or missing from one tree are changed
- Only metadata is compared, not file contents
- Unchanged files are detected instantly via hash comparison
- HAMT structure allows efficient parallel traversal
- No need to download or hash file data
Use Cases
Verify Backup Changes
Confirm that a backup captured expected changes:Investigate Issues
Find out what files were affected between two points in time:Audit File Changes
Track changes to specific directories over time:Compare Sources
Compare backups from different sources (e.g., production vs staging):Comparing Same Snapshot
Comparing a snapshot to itself shows no changes:Snapshot Order
The order of snapshots affects the interpretation:Forward Diff (Old → New)
- added — Files added in new snapshot
- removed — Files removed in new snapshot
- modified — Files changed in new snapshot
Reverse Diff (New → Old)
- added — Files that were removed (now re-added going back)
- removed — Files that were added (now removed going back)
- modified — Files that changed (reverse direction)
Performance
Diff performance depends on:- Snapshot size — Number of files in the snapshots
- HAMT depth — Deeper trees require more traversal
- Storage backend — Cloud storage is slower than local storage
- Overlap — Snapshots with more shared files are faster to compare
- 1,000 files: less than 1 second
- 10,000 files: 1-3 seconds (cloud storage)
- 100,000 files: 10-30 seconds (cloud storage)
Diff only loads metadata for files that exist in at least one snapshot. Unchanged files (same HAMT subtree) are skipped via structural sharing.
Directories vs Files
The diff output shows both files and directories:- Files are compared by content hash (modified if content changed)
- Directories are compared by their HAMT subtree hash (modified if any child changed)
documents/ directory is marked as modified because its contents changed (a file was added).
Unchanged Files
By default, unchanged files are not shown. Use-verbose to see all files:
Encryption
If your repository is encrypted, you must provide valid credentials:Machine-Readable Output
The diff output is designed for both human and machine consumption:Change objects.
Limitations
Content-Based Comparison Only
Diff compares files by content hash, not by name. If a file is renamed without changing content, it appears as:No Line-Level Diffs
The diff shows which files changed, but not what changed within files. For line-level diffs, restore both snapshots and use external tools:See Also
- cloudstic list — List all backup snapshots
- cloudstic ls — Browse files within a specific snapshot
- cloudstic restore — Restore files from a snapshot
- cloudstic forget — Remove old snapshots based on retention policies