For a few days I’ve had the idea of a command that is based loosely on
git filter-branch, the idea being that you would pass it a list of snapshots IDs or snapshot filters (
--tag, etc.) and also a script that would be run for each snapshot.
Any changes could result in the introduction of (possibly-deduplicated) trees and/or blobs to describe the modified snapshot, as well as the new snapshot itself. An option to the subcommand could be used to indicate whether the old snapshots should be removed or kept after the operation (something like
--keep-old… possibly even both switches and make it mandatory to specify which). As with
forget, the command could also accept
--prune to automatically prune if any changes were actually made.
I’m thinking particularly of use cases where sensitive data is accidentally backed up when it shouldn’t have been, and old snapshots need to be scrubbed of this data, but we don’t want to lose the whole backup.
A less-important but still valuable use case is when a large backup is completed and you noticed that there’s a directory you should have excluded, so you add it to the backup script but don’t want to interrupt and re-run the backup. A simple rewrite script could drop those directories from the snapshot.
The current way to do this is to restore each snapshot, make the changes, and re-run the backup. This is time-consuming, inefficient, and needlessly wears storage devices.