Assumptions
- your team all have Git installed
- your team is using Unity 5.0 or higher
- your team is following Git-flow branching model (if not, feel free to skip the steps for
developbranch)
Install Git LFS
For more information about Git Large File Storage (LFS), see here.
For Mac users, installing Git LFS using Homebrew is recommended (your Git itself should be installed via homebrew too!). To install, just run brew install git-lfs.
For Windows users, download the installer from official website and run. After the installation process, run git lfs install in your git bash to activate it.
Create the Repository (for team leader)
- install Git LFS (see Install Git LFS section)
- add file types to use Git LFS to manage by running
git lfs track "*.<file_extensions>"- for example, to use Git LFS to manage
psdfiles, rungit lfs track "*.psd" - Tip: file types I use Git LFS to manage are:
.psd,.png,.mp3,.wav,.prefab,.fbx,.xcf(Warning: It is not recommended to use LFS to manage.unityscene files, otherwise you will be forced to have only one person working on a scene at all times) - Note: this step can be done by editing
.gitattributesdirectly, one line one type, like this:*.psd filter=lfs diff=lfs merge=lfs -text
- for example, to use Git LFS to manage
- create an empty Unity project
- change project settings (based on this Stack Overflow post)
- Go to Edit → Project Settings → Editor
- Change Version Control Mode to Visible Meta Files
- Change Asset Serialization Mode to Force Text
- Save Scene and Project
- prepare the Git repo
- run
git initto initialize a Git repo - create a
.gitignorefile for the repo by copying this .gitignore file - add
.gitconfigfile for your system OR configure your Git client (SourceTree, etc.) to use Unity’s Smart Merge (for detailed instruction, see this official article) - push branch
masterto remote
- run
- prepare the
developbranch- run
git branch developto create a new branchdevelop - run
git checkout developto switch to branchdevelop - push branch
developto remote
- run
- add your team member as collaborators of your Github repository and send them step in the next section to follow
Clone the Repository (for other team members)
- install Git LFS (see Install Git LFS section)
- prepare project folder
- create an empty Unity project
- quit Unity
- Important: delete ProjectSetting folder
- prepare the Git repo
- run
git initto make this project a git repo - run
git remote add origin <remote_repo_address>to add remote repo - pull remote branch
origin/masterto local branchmaster - run
git branch developto create a new local branchdevelop - run
git checkout developto switch to branchdevelop - pull remote branch
origin/developinto local branchdevelop
- run
- add
.gitconfigfile for your system OR configure your Git client (SourceTree, etc.) to use Unity’s Smart Merge (for steps, see this official article) - open the project in Unity and start to work
