How to track large files (database, PSD, bin) in Git?


Sometimes you have PSD or a small-ish SQLite file you’d like to track with Git. The problem is Git is bad at tracking changes in big binary files by default.

With Git Large File Storage (LFS) you can replace these large files with text pointers while storing the file contents on a remote server. Both GitHub and BitBucket support it. Here is how to get started:

1. Install Git LFS extension (Mac here):

brew install git-lfs

2. In your repo run git lfs:

cd repo
git lfs install

3. Set the file patterns you want LFS to handle. This will create a .gitattributesfile, make sure you track it too.

git lfs track "*.psd"

4. You’re all set! From there just use regular git commands:

git add design.psd
git commit -m "Add design file"
git push origin master