Principle to avoid Headaches with Git and Git LFS with Unity.

  • You put text-based files in git
    - You put static binary files in LFS
    - You exclude other stuff like generated files (because they are auto-generated on compile, on the build, or at runtime, so there is no need to track them.)
  • Know what files are text-based and what files are binary, this is usually done by looking at file extensions.
    - Know where these files are so that you can include or exclude them by paths.
    - Know how to merge these files properly, either with git, or some third-party merge tool like UnityYAMLMerge.
  • .asset/.unity files can be text or binary or both:
    - a simple scriptable object? text
    - lighting data or terrain data or nav mesh? binary
    - text mesh pro font asset? both (because you can store binary data in YAML)
    - a unity scene with pro builder mesh in it? both (because these meshes are encoded as binary data)
  • - things are generated without you knowing:
    - Addressables put generated content under both /Assets/AddressableAssetsData/ and /Assets/StreamingAssets/ (I understand why it does it, but then it’s up to me to tell git and LFS to exclude these generated content, or track them but face frequent changes)
  • - merge tool is no longer at a fixed location:
    - With unity hub, we no longer install Unity at a fixed location, hence unityyamlmerge location can change too, good luck updating it each time.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Suleiman Abdullah

Suleiman Abdullah

Self taught Unity Developer, who is passion about making games