I like to keep unused files around in case I need them but I probably won't need files from more than a month ago. Is there a way to drop or move just unused files that were last referenced >x days ago and keep the rest?
I like to keep unused files around in case I need them but I probably won't need files from more than a month ago. Is there a way to drop or move just unused files that were last referenced >x days ago and keep the rest?
There's a new command, added just last week, that gets close to this.
git annex whereused --unused --historical
will display each unused key, along with a git rev where that key was found to be used.The git rev looks like eg "master~4:filename" or "HEAD@{40}:filename". It will usually be the most recent use, although it prefers older uses that made it into a branch over any revs from the reflog.
Seems like perhaps
git rev-list --no-walk --before=
could be used in a shell pipeline with whereused. I suppose it would be a kind of ugly pipeline, since it would have to extract the rev, strip the filename from it, pass it through git rev-list, and then output the key when rev-list output a rev.Or, the same method that whereused uses to find where keys were used could be applied in something like
git annex unused --older-than=1day
.