Git LFS and Unity

Alwin Kuruvilla
2 min readJul 18, 2021

--

Visual of Git LFS
Visual of Git LFS (Found here)

Git LFS (Large File Storage) is a innovative way to keep track of large binary files like audio, images, and models. The reason why you need Git LFS is because these files can be duplicated during each commit and will cause unnecessary bloating of your repository. Git LFS solves this by saving pointers to your files rather than backing them up completely.

Getting Started

Let’s get started with Git LFS for your Unity project:

  1. Once you’ve initialized your local repository using git init, type in git lfs install.
  2. Now you can add files or file extensions by typing in git lfs track “<file>”. Example: To track all .png files you type: git lfs track “*.png”. Note: Don’t forget the wildcard in front for file extensions.
  3. If you have a lot of files you can create/edit the .gitattributes file in your project’s root directory.

Git LFS and Unity

Once you have your .gitattributes file created, you can edit the contents of it by opening it in any text editor.

Hextant Studios has created a pretty good list of files that should be in your .gitattributes file for a Unity project. You can find this list here: https://hextantstudios.com/unity-gitattributes/

Conclusion

Git LFS is a wonderful tool that will keep your repository clean and bloat free. Remember to start using it on your next project!

--

--

Alwin Kuruvilla
Alwin Kuruvilla

No responses yet