Since all the annexed (in indirect mode) files are symlinks to topdir/.git/annex/... moving files among directories at different levels is not that straightforward since symlinks would get broken. And since there is not 'annex mv' command -- what is the best way? (unlock is not the resolution since it copies the file, which might be prohibitively large and inefficient)
You can move the symlinks however you like (git mv, or regular mv and git add).
To fix up broken symlinks, you can either run
git annex fix
, or just commit the move. The pre-commit hook fixes up links automatically.I couldn't find an explanation for this using the search bar, so I thought this would be as good a place as any to ask this.
Even when I run
git mv
on git annexed file, git annex always changes it for what looks like a combo ofgit rm old_symlink; git add new_symlink
I guess it does this when that pre-commit hook you mentioned runs. Why?
Correction:
Why do moves that require changes to the symlinks to change result in a delete+add combo?
Code to reproduce just for the sake of completion:
I'm sorry if this has been already explained previously. I couldn't find it.
Git tracks the symlink. After your first commit, here's what is tracked for protein/milk:
And after your second commit:
Note that it's exactly the same content, and Git will (by default) present it as a rename.
In your final commit, the link that Git tracks changes:
Notice that the leading part of the link changed, corresponding to the movement out of the subdirectory.