Git Project Binaries
Over the last 6 months or so I've been moving all my old projects to cloud-based Git repositories (BitBucket). Some of those projects, like Helicopter Game and Tank Game, have a lot of 3D models, images, and other large binary files. I don't want to add these to Git because I want to keep cloning time to a minimum, and I often need to add/modify/delete them. But I also want to keep track of them and not lose them because they're essential to the project.
There are existing tools like git-annex that look promising, and I want to revisit this. For the moment, though, I just want a quick-and-dirty fix that gives me peace of mind I'm not going to lose anything important.
One possible solution I'm trying is to store these files in Dropbox instead. Before I learned how to use Git (embarrassingly recently, and a work in progress), Dropbox was my solution for everything. I kept my entire project in Dropbox, with frequent local backups. Yes, that meant constantly uploading every build, but at that point the only VCS I knew how to use was SVN. Git is way cooler.
Yesterday morning I wrote some python to help me try out copying over files from my Dropbox directory to the project directory. It assumes that Dropbox files have the same relative path from project root as they do in the actual project directory.
It's very, very hacky. I'll see how this goes, I haven't really tested it properly yet.
#!/usr/bin/python import os import shutil from distutils import dir_util current_path = os.path.dirname(os.path.realpath(__file__)) dirname = os.path.split(current_path) target = '/Users/Ben/Dropbox/Dev/project/' + dirname files = os.walk(target) for adir in files: for afile in adir: if (afile.startswith('.')): continue source = os.path.join(adir, afile) dest = os.path.join(current_path, os.path.relpath(source, target)) parent = os.path.abspath(os.path.join(dest, os.pardir)) if (not os.path.isdir(parent)): os.makedirs(parent) shutil.copy(source, dest)