Often you will want to move some file contents from a repository to some other one. For example, your laptop's disk is getting full; time to move some files to an external disk before moving another file from a file server to your laptop. Doing that by hand (by using git annex get and git annex drop) is possible, but a bit of a pain. git annex move makes it very easy.

# git annex move my_cool_big_file --to usbdrive
move my_cool_big_file (to usbdrive...) ok
# git annex move video/hackity_hack_and_kaxxt.mov --from fileserver
move video/hackity_hack_and_kaxxt.mov (from fileserver...)
SHA256-s86050597--6ae2688bc533437766a48aa19f2c06be14d1bab9c70b468af445d4f07b65f41e   100%   82MB 199.1KB/s   07:02
ok

I may be missing something obvious, but when I copy to a remote repository, the object files are created, but no softlinks are created. When I pull everything from the remote, it pulls only files the local repo knows about already.

    A
   / \
  B   C

Moving from B to A creates no symlinks in A but the object files are moved to A. Copying back from A to B restores the object files in B and keeps them in A.

Copying from A to an empty C does not create any object files nor symlinks. Copying from C to A creates no symlinks in A but the object files are copied to A.

-- RichiH

git annex move only moves content. All symlink management is handled by git, so you have to keep repositories in sync using git as you would any other repo. When you git pull B in A, it will get whatever symlinks were added to B.

(It can be useful to use a central bare repo and avoid needing to git pull from one repo to another, then you can just always push commits to the central repo, and pull down all changes from other repos.)

Comment by http://joey.kitenet.net/ Wed Mar 23 00:38:10 2011

Ah yes, I feel kinda stupid in hindsight.

As the central server is most likely a common use case, would you object if I added that to the walkthrough? If you have any best practices on how to automate a push with every copy to a bare remote? AFAIK, git does not store information about bare/non-bare remotes, but this could easily be put into .git/config by git annex.

-- RichiH

I would not mind if the walkthrough documented the central git repo case. But I don't want to complicate it unduely (it's long enough), and it's important that the fully distributed case be shown to work, and I assume that people already have basic git knowledge, so documenting the details of set up of a bare git repo is sorta out of scope. (There are also a lot of way to do it, using github, or gitosis, or raw git, etc.)
Comment by http://joey.kitenet.net/ Wed Mar 23 15:28:00 2011
Comments on this page are closed.