Annexed submodules in git

I’d like to keep some binary files (documentation, executable binary files, images, etc) in a git-annex, and then include them in several projects as git-submodules. I think this will allow me to keep track of the correct versions of these large files as they change, keeping old projects linked to the old versions and new projects to the new versions.

So I make the following repo for my big files:

  • How can I pass git SHA1 to compiler as definition using cmake?
  • Migrate from one set of bare git repositories to another
  • How do I use git-tfs and idiomatic git branching against a TFS repository?
  • Is it possible to use GitHub and GitLab on one machine?
  • Make Github push to a remote server when it receives updates
  • Is there a way to view git history using external diff tool?
  • mkdir annexedrepo
    cd annexedrepo
    cp big_files annexedrepo/
    git init
    git annex init
    git annex add .

    and then go to my project repo and add them as a submodule.

    cd ../otherrepo
    mkdir data
    git submodule add ../annexedrepo data/annexed

    I’d love if these would just appear as symlinks to the correct files in the other repo. But I guess it’s good enough if I can just make the copies as I need them with:

    git annex get data/annexed

    This copies the files over – I can see them in otherrepo/.git/module/data/annexed/objects/. But when I do this, the annexed files are just dead symlinks. I can list them with ls data/annexed/, but nobody’s home.

    Am I trying to do something wrongheaded? Is there a way to fix this? Are these bugs in either git-submodule or git-annex? Thanks for your help!

  • How to apply `git diff` patch without Git installed?
  • Ideal workflow for Git repository for software project and companion server code?
  • How I can use ruby-git to recursively clone a remote repo?
  • Can I use `git subtree split` to maintain a “fork” of a project's subdirectory?
  • git reset --hard, how will it affect my commits and branches?
  • How to change the text editor in git to Sublime - currently git commit commands are opening in Notepad
  • 2 Solutions collect form web for “Annexed submodules in git”

    I am using the same source tree structure and also tried to use git-annex but met the same problem. I found out the git-fat extension can be used instead of git-annex and has no such an issue. So my source tree looks like this:

        <project files and folders>
            <binary files>

    To clone such a project

    git clone git://... project
    cd project
    git submodule init
    git submodule update
    cd submodule
    git fat init
    git fat pull

    The git-fat uses rsync to push/pull files. See more about git-fat.

    Well, with a bit of fiddling, I’ve found a work-around. I’d love to see something better, though. Posting this for posterity, but I’m hoping to find a better solution.

    In data/annexed, there is a file, .git, which contains a reference to ../../.git/module/data/annexed/. I removed this file and replaced it with a symlink to the same location. I now have access to ../annexedrepo/ from inside data/annexed, and my files are at the right version. I’m a bit worried about causing future problems with this workaround…

    Git Baby is a git and github fan, let's start git clone.