Ready to launch your next project?

Contact Us

Notes

Adventures in Git LFS (Large File Storage)

Git LFS, or Large File Storage, is a method for storing files that don’t change often (e.g, images and videos), outside of the git repo.

Usually this isn’t a concern for most projects as Bit Bucket supports 1GB repos (…really up to 2GB with an annoying warning.)

However, if you find yourself branching a lot on project, it’s probably worth using LFS.

Setting it up is easy. First install it by downloading it, or using homebrew or macports as described here.

Then you just specify which files you want it to track. In this example, I’m telling it to put all files in the media folder into LFS:

It works well…with a few huge caveats that make me *not recommend* this unless you find yourself hitting the git repo limit.

  1. Adding Git LFS after-the-fact to a standard repo is a PITA. It’s best to avoid doing this, and just start out by using Git LFS from the get-go.
  2. However, Git LFS and Dandelion deploy do *not* get along. Anything that is in LFS will not be uploaded properly with Dandelion. Therefore, you should also exclude the same folders that you’re tracking in LFS in the Dandelion file, and simply upload those images manually with FTP.
  3. HOWEVER (not tested), migrating the images with WP-DB Pro *should* work, so…there’s that.

Filed Under