Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
*.physicsMaterial2D merge=unityyamlmerge eol=lf
*.physicMaterial merge=unityyamlmerge eol=lf
*.asset merge=unityyamlmerge eol=lf
*.meta merge=unityyamlmerge eol=lf
*.controller merge=unityyamlmerge eol=lf
## git-lfs ##
#Image
*.jpg filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.psd filter=lfs diff=lfs merge=lfs -text
*.ai filter=lfs diff=lfs merge=lfs -text
#Audio
*.mp3 filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.ogg filter=lfs diff=lfs merge=lfs -text
#Video
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.mov filter=lfs diff=lfs merge=lfs -text
#3D Object
*.FBX filter=lfs diff=lfs merge=lfs -text
*.fbx filter=lfs diff=lfs merge=lfs -text
*.blend filter=lfs diff=lfs merge=lfs -text
*.obj filter=lfs diff=lfs merge=lfs -text
#ETC
*.a filter=lfs diff=lfs merge=lfs -text
*.exr filter=lfs diff=lfs merge=lfs -text
*.tga filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.dll filter=lfs diff=lfs merge=lfs -text
*.unitypackage filter=lfs diff=lfs merge=lfs -text
*.aif filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.rns filter=lfs diff=lfs merge=lfs -text
*.reason filter=lfs diff=lfs merge=lfs -text
*.lxo filter=lfs diff=lfs merge=lfs -text
@benkoadam
Copy link

benkoadam commented Dec 30, 2021

Since you are using yamalMerge for *.unity, lets say that you have just created a scene with more than 200 MB in size. How will you push it ? Did you increase your git push limit too ?

@Hoodad
Copy link

Hoodad commented Jan 27, 2022

To prevent LightingData.asset to become corrupted I highly recommend to treat it like a binary file. When working we have had multiple occureneces where the LightingData.asset ended up corrupt when pushed through LFS due to the unityyamlmerge

LightingData.asset filter=lfs diff=lfs merge=lfs -text

@fkkcloud
Copy link

fkkcloud commented Apr 14, 2022

with #*.wav filter=lfs diff=lfs merge=lfs -text, when I merge other branches that has changed .wav files, I am getting .wav files "dirty" and listed in the changelist (it is not the conflict btw) every time. if I remove "filter=lfs", it works fine. any ideas?

@omundy
Copy link

omundy commented Apr 21, 2022

Thanks for this. Consider adding .psb files (along with PSDs)

@SuleimanAbdullah
Copy link

SuleimanAbdullah commented Jun 23, 2022

Thanks, @Hoodad I have spent weeks to solve this but light data make push large file failed I follow your recommendation and the push worked thanks again you save my day

@Breanzy
Copy link

Breanzy commented Jun 23, 2022

Thanks for this ^^

@Begounet
Copy link

Begounet commented Nov 3, 2022

Months later, got the same issue, because based my .gitattributes on this. Thank you @Hoodad! Should really consider adding this to the file.

@jwvanderbeck
Copy link

jwvanderbeck commented Nov 3, 2022

As I had pointed out way above, the yaml merge tool is NOT supposed to be used on .asset files. Only .unity and .prefab

@SuleimanAbdullah
Copy link

SuleimanAbdullah commented Nov 4, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment