Using Git LFS in your Unity Project
Git large file storage
Objective:
Install Git LFS and add it to you unity project
What is Git LFS?
When you are working in a project with a lot of large assets such as audio or videos and these are updated as you commit to your repository, your repository will have a copy of each version of these assets but actually you don’t need to have all versions in your computer.
Git LFS remplaces the large files with text pointer inside Git while storing the large files content in a remote server like Github.com.
Installing Git LFS
- Windows:
Download Git LFS here and follow the installer instructions.
- Mac OS:
Open the terminal and run the command below:
brew install git-lfs
Note: You have to have Git and Homebrew Installed.
Adding Git FLS to you project
It’s very simple, to select the file types you’d like Git LFS to manage just run the command (in this example we are adding photoshop files to git lfs):
git lfs track “*.psd”
This add the following to your .gitattributes file:
*.psd filter=lfs diff=lfs merge=lfs -text
Note: you can modify directly your .gitattributes instead run the command
And you are done, you can push your commits as usual
git add file.psdgit commit -m “Add design file”git push origin main
.gitattributes Template
Here I left you a .gitattributes file template with the most common file types already added