Requires having Git and Git LFS installed. These instructions were written and tested on mac.
If you are cloning a repo that is already setup, skip straight to the .gitconfig step, everything else should be done for you.
If you are creating a repo, cd into the folder in terminal and run git init
then git lfs install
to setup git and enable lfs.
Create a .gitignore
and .gitattributes
file by coping the ones above. Add all the remaining files to the repo to be tracked by Git.
This step only has to be done once per machine.
To resolve conflics in unity's .scene and .prefab files you will need to use unity's custom merge toool, UnityYAMLMerge.
Add the configuration above to your user .gitconfig
file located at ~/.gitconfig
. This sets up 'unityyamlmerge' as a tool availble to git, but doesn't enable it by default.
If you get a conflict in the repo, cd into the folder in terminal and type git mergetool --tool=unity
On Windows the path for Unity's merge tool will be something like
cmd = 'C:\\Program Files\\Unity\\Hub\\Editor\\2020.3.18f1\\Editor\\Data\\Tools\\UnityYAMLMerge.exe' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
You can find the location on your machine using 'Everything' to search for it.