How to start syncing two existing directories with git annex?

Joey Hess joey at
Sun Nov 24 21:42:52 CET 2013

Sean Hammond wrote:
> Hey, I have a ~/Music directory on computer A, and a ~/Music
> directory on computer B. They contain mostly the same files (and
> with the same paths). But there might be some files on A but not B,
> or vice-versa. And there might be some files on both but different
> (e.g. different id3 tags).
> I want to use git annex assistant to sync the two dirs. Neither
> computer is big enough to hold two copies of the Music dir at once.
> Ideally, I'd prefer not to have to delete the Music dir from
> computer B, for example, and then let git annex sync it from A over
> to B again.
> I've setup git annex assistant on both machines and have them
> syncing their ~/Annex dirs over the local network.
> Now how can I start syncing the two music dirs? What will happen if
> I, for example, drag ~/Music into ~/Annex on computer A then,
> without waiting, do the same on B?

As soon as one knows it has a file, it will try to send it to the other.
If the other has not yet gotten around to adding that file, it will
accept it, and use some disk space storing the duplicate copy of the
file. Once it finds the same file in the Music directory you moved into
it, the extra disk space will be freed back up.

I'd expect this to result in a small amount of duplication, assuming
both A and B are roughly the same speed, and process the files in
roughly the same order.

If they, say, processed the file list in reverse order at the same speed,
each would queue up transfers of the half it does first to the other one.
If you had a fast enough network, this could result in each repositoriy
temporarily using an extra 50% of its size (approaching 100% in the
worse case where eg, A is extremely fast, B is dog slow, and A can
somehow instantaneously send files to B). The real world duplication
amount seems unlikely to be very large in practice, but I have not
quantified it.

To avoid any redundant transfers at all, you can temporarily stop the
assistant on both, and manually `git annex add` the files on both, then
restart the assistants.

If a file differs between A and B, you will get a file.variant-A and a
file.variant-B and will probably want to resolve this by renaming one
and deleting the other.

see shy jo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <>

More information about the vcs-home mailing list