Hi,

I am a happy user of git-subtree, and I wonder whether it integrates nicely with git-annex?

My use-case looks like this: I have two annex repositories -- one at home and one at work. The annex at work is a strict subset of the one at home, i.e. all files that I have at work ought to be part of the annex at home, but not the other way round. Now, I realize that I could have one annex and selectively copy files to the checked out copy at work, but I don't want to do that because I don't want to have (broken) symlinks for all kinds of stuff visible on my machine at work that is not supposed to be there (such as MP3 files, etc.). Instead, I would like to use git-subtree to import the work annex into a sub-directory of the one at home, so that both annex are logically separate, but still the one at home always contains everything that the one at work contains.

Is that possible?

And if not, is there maybe another way to accomplish this kind of thing?

I have no experience using git-subtree, but as long as the home repository has the work one as a git remote, it will automatically merge work's git-annex branch with its own git-annex branch, and so will know what files are present at work, and will be able to get them.

Probably you won't want to make work have home as a remote, so work's git-annex will not know which files home has, nor will it be able to copy files to home (but home will be able to copy files to work).

Comment by http://joey.kitenet.net/ Tue Jan 3 17:00:53 2012
The point of git-subtree is that I can import another repository into sub-directory, i.e. I can have a directory called "work" that contains all files from the annex I have at work. If I make the other annex a remote and merge its contents, then all contents is going to be merged at the top-level, which is somewhat undesirable in my particular case.
Comment by http://peter-simons.myopenid.com/ Tue Jan 3 18:11:37 2012
You can make it a remote without merging its contents. Git will not merge its contents by default unless it's named "origin". git-annex will be prefectly happy with that.
Comment by http://joey.kitenet.net/ Tue Jan 3 18:42:08 2012
Okay, I see, but is git annex get --auto . going to import all those files from the work remote into my home if the master branch of that remote isn't merged?
Comment by http://peter-simons.myopenid.com/ Tue Jan 3 19:17:36 2012
Yes; git-annex uses the git-annex branch independently of the branch you have checked out. You may find internals interesting reading, but the short answer is it will work.
Comment by http://joey.kitenet.net/ Tue Jan 3 19:31:45 2012
Very cool! Thank you for the explanation.
Comment by http://peter-simons.myopenid.com/ Tue Jan 3 19:47:11 2012
Comments on this page are closed.