- Home /
How to properly use git with a team?
I am working on a game with one of my friends, and every time we push / fetch there are multiple errors relating to binary files / metadata files because unity changes the files automatically on startup and while we are just generally using the app. Because the files are not matching, not everything is able to be added, and there are constant errors. What is the best way to deal with this?
Have you read the manual first ?
http://docs.unity3d.com/$$anonymous$$anual/ExternalVersionControlSystemSupport.html
Answer by taxvi · Mar 21, 2016 at 12:33 PM
You need to tell the version control system to ignore those files. I use .git and I've recently found this amazing unity .gitignore file on github which basically syncs only Assets and ProjectSettings folders. ProjectSettings contain useful info like layers, and quality settings, etc...
Apart from this, github also has a very nice feature of providing up-to-date gitignore files by default when you are setting up a repo there:
Answer by RChrispy · Mar 21, 2016 at 01:05 PM
I use a .gitignore and a .gitattributes file to manage the basics. Just add this into your git repository folder.
.gitignore:
##################
# Unity ignores:
##################
Temp/
Library/
obj/
ExportedObj/
*.csproj
*.pidb
*.unityproj
*.suo
*.sln
*.svd
*.userprefs
*.user
*.booproj
################
#OS generated
################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
.gitattributes:
*.prefab binary
*.unity binary
*.anim binary
*.controller binary
*.mat binary
*.asset binary
*.png binary
*.jpeg binary
*.jpg binary
*.wav binary
*.mp3 binary
great answer.
one note: do not git-ignore .meta files ! the answer does not say you should, but it's worth saying because the OP asked about them. .meta files contain critical information about asset files, and they work fine w/ a multi-person $$anonymous$$m using git.
True .meta files are important! ;)
ps: If you like the answer please upvote so others see it faster. :)
Answer by Link0n3 · Mar 24, 2016 at 01:26 PM
There are plenty of blogs/posts out there explaining how to do that. One very simple that cover all the passages is the following: Unity and Git
Remember that apart from the necessary gitignore you have to change also editor in project settings. Probably the error you get could do to the meta option that is there.