Unity and GIT .gitattributes

Hey,
so I work a long time with Unity and git and it works quite well but we have sometimes problems with prefabs and such. So I made a git attribute file and I am not sure if this works or if I have done this correctly just want to know your opinion and if my file does something wrong please explain it to me I am happy to learn! :slight_smile:

.gitattributes:

*.prefab -merge -crlf -diff
*.unity -merge -crlf -diff
*.anim -merge -crlf -diff
*.controller -merge -crlf -diff
*.mat -merge -crlf -diff

Does this work like I think it does and prevents auto merge. And git will tell the user to merge manualy or choose between both files?

Did nobody had the same prefab breaking problems? Or just no opinion because my question is to easy and I should know it?

I get the impression not many people read this subforum. I don’t have an answer to your question, I’m afraid. I’m just now trying to decide on a revision control system to use with Unity. I like Mercurial, and git is just fine although I’ve never used it on Windows and kind of wonder how well it works there. Seems like a poor fit for a GUI oriented OS.

I use git with Unity daily (have for years) never had any merge issues, ever… But we do avoid ever editing the same scene or prefab to avoid merge conflicts… So perhaps that’s why I don’t have issues :slight_smile:

I assume you’ve set Edit->Project Settings->Editor->Asset Serialization to “Force Text” (it sounds like you have, but just in case).

Also make sure you’re using Unity - Manual: Smart merge

1 Like

Yeah that is set thanks for your reply. We try to avoid prefabs and scenes too. But sometimes it happens. ^^

Thanks for the link I will look it up!

ps: since I added my .gitattributes we didnt have problems but well we had only realy rare problems to begin with so I will post if this helped or not later :wink: