Ah, not exactly: running
rebuild-index will make sure that all data which is saved in the repo will be contained in an index file, so on the next run of
backup, restic is aware of all the data that is in the repo. Normally, it should not matter and you should not need to run
rebuild-index after an aborted upload, but if you have a really tiny upstream bandwidth and would like to avoid uploading even a couple of megabytes of data, then
rebuild-index is a good thing here. During backup, restic will regularly upload so-called intermediate index files which cover all the data that has been uploaded so far. So without running
rebuild-index after a failed backup restic will only re-upload the data that has been uploaded since the last intermediate index, which is at most 15 minutes (if I remember correctly).
Yes, it will still delete the data. After running
rebuild-index, restic is aware that there’s data in the repo, but the data is still not referenced by a snapshot. So
prune thinks the data is not needed any more and removes it.