There are 59 new files. Both commands return the same number.
backup reports 370 changed files. I guess this includes also deleted files?
diff reports 37 removed and 350 changed files. The summary of both is 387. So my guess that backup reports both deleted and changed files in one number is not true.
Why do both commands report different amounts of “changed” files?
When `restic backup` runs, it reports changes from the perspective of what’s currently on your filesystem compared to the parent snapshot. So “370 changed” means 370 files that existed in both snapshots but had different content/metadata.
When `restic diff` runs, it’s comparing two complete snapshots and showing you the full picture: files that were added, removed, AND changed between those specific snapshots.
The “350 changed” from diff represents files that exist in both snapshots but differ. The discrepancy (370 vs 350) likely comes from:
Files that were modified AND then deleted during your backup operation
Timing differences in how the commands process file changes
Possibly some files that were detected as changed during backup but when comparing the final snapshots, show up as removed instead
The `restic diff` output is generally more accurate for understanding what actually changed between two snapshots.
When restic backup runs, I suspect it to display changes and additions w.r.t. the parent snapshot and expect the created snapshot to contain exactly these displayed changes.
And this means that restic diff on the parent and the created snapshot (as @richard did run) should also show the same differences.
For me this looks like a bug - either in the output of restic backup or in restic diff.
My earlier answer was off @alexweiss, after digging around I found this thread which has more information.
The difference: restic backup counts a file as “changed” if content or metadata changed, while restic diff by default only reports content changes.
@richard, try restic diff --metadata 28 a3 (your two snapshots) and you should see additional files marked with U (metadata updated). That should account for the 370 vs 350 gap.
TL;DR: restic backup uses metadata to detect potential changes, restic diff shows what actually differs. Files detected as “changed” may end up as M (content changed) or U (only metadata changed) in diff output.
After checking the restic docs again, here’s what I suspect is happening:
How restic backup detects “changed”:
It uses metadata heuristics, mtime, ctime, file size, and inode number. If any of these changed, the file is marked as “changed” and re-read. It doesn’t compare actual content.
How restic diff reports changes:
M = actual stored content differs between snapshots
Your backup detected 325 files as “changed” based on metadata heuristics. But when diff actually compared the stored content:
193 files had real content changes → M
~132 files had metadata changes that triggered backup’s detection, but identical content → U
This would be expected behavior. A file’s mtime can change (triggering backup’s “changed” detection) even if the content is the same, for example, if a file was touched, overwritten with identical content, or restored from another backup.
The 329 U entries would include both those ~132 files plus directories with metadata changes (explaining your 195 changed dirs).