[Tutorial] Using Git LFS with FiveM resources

This is a quick tutorial on how to properly leverage the power of Git LFS when you have a git repository with FiveM server resources. If you’re using git, but not LFS (yikes), I urge you to try it out.


First, make sure that your working directory is clear so you don’t accidentally commit anything you don’t mean to.

Next, you will need to modify / append these settings to the .gitattributes file in your project root.
If you don’t have this file yet, create it with the following contents:

.gitattributes

# FiveM assets
*.yft filter=lfs diff=lfs merge=lfs -text
*.ytd filter=lfs diff=lfs merge=lfs -text
*.ymap filter=lfs diff=lfs merge=lfs -text
*.ydr filter=lfs diff=lfs merge=lfs -text
*.ybn filter=lfs diff=lfs merge=lfs -text
*.ymf filter=lfs diff=lfs merge=lfs -text
*.ydd filter=lfs diff=lfs merge=lfs -text
*.ytyp filter=lfs diff=lfs merge=lfs -text
*.rpf filter=lfs diff=lfs merge=lfs -text

# native binaries
*.dll filter=lfs diff=lfs merge=lfs -text
*.so filter=lfs diff=lfs merge=lfs -text

# fonts
*.eot filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.woff filter=lfs diff=lfs merge=lfs -text
*.woff2 filter=lfs diff=lfs merge=lfs -text

At this point all you should need to do is:

git add .

Git will automatically index your files, find any matching extensions, and mark them as changed, ready to be committed to your Git repo using LFS. The initial push may take a long time if you have a lot of resources.

That’s it folks.

3 Likes

Interesting

1 Like

1 GB wouldn’t help for any of those extensions xD