How can we find the old versions /commits of a file?
For example, if a file had been updated three times, how can we find the other 2 old versions, provided I only have the hash of the final version of the file?
Is there any command to list old commits?
Also, is there a way to unpin all older commits of a file, except the latest one?
The solution I am trying to understand is that if I am developing a website and I am constantly updating files and adding the folder to IPFS, the old files still remain pinned on my local node. And I may not need those old files, they are just consuming space as they accumulate over time. My website is already committed to git so I have backups.
Not sure how to view older versions of files while just having the latest hash.
However you can use
ipfs pin update <oldCID> <newCID> to update pins (unpins old CIDs, pins new CIDs).
Also if manually updating everything is a chore, I have ipfs-sync available for exactly that.
tl;dr: you need to keep track yourself of what the older hashes are
Since adding pins content by default, you can list pinned things with
ipfs pin ls --type=recursive. You can unpin things you don’t want (
ipfs pin rm). Potentially unpin everything, add your site again (so there will be a single pin) and then run
ipfs repo gc to clean up anything that is not pinned.
Thanks @hector for your answer. This is what I am presently doing.
Thank you @Discordian for your tool. I will try it and update you.