I have a research project where I want to save some but not all versions. Those that should be saved are tagged. I want to create a repository (and archive it) that contains only those files. It is, so to say, the inverse of --unused.
I tried to clone a present repository to an new folder and move there only files that are referenced by some ref (branch or tag).
But git annex does nothing:
git clone my-repo repo-archive
cd repo-archive
git annex init
git annex copy --to=here --not --unused
However, git annex exits without copying any files, my repo is still empty afterwards.
I also tried git annex findkeys --not --unused, but it says invalid option --unused
In real life I have multiple repositories that all have part of the files I want, so I cannot just make a repo that has all versions of all files and then drop --unused
. That also would take too much storage.
How can I do this?
There may be a simpler way, but one idea:
So something like this:
If you wanted to focus just on keys referenced from tags, you could generate a list of those keys with
After generating a list of keys with either of those approaches, you could copy them to your new repo with
For example, the full pipeline for the second approach could be
The reason
git-annex copy --not --unused
behaves that way is that --unused is not a file matching option. --not, meanwhile, inverts the next file matching option. So here it does nothing. So that command is the same asgit-annex copy --unused
!Obviously, that's a bit of an excuse, but it's what's going on. I do think that having
--not --unused
work would be a useful thing. Opened a todo ?em>--unused.