Like rsync, rdiff-backup is a tool used for incremental backups. Unlike rsync however, rdiff keeps the most-recent file change, along with any previous changes, deletions, etc.
sudo apt install rdiff-backup
rdiff-backup $dir $backup
rdiff-backup -r 2D $backup $restore_dir
Only keep backups for a certain time period
rdiff-backup --force --remove-older-than 2M $backup
This will remove all backups older than 2 months from $backup.