Using Unity with GIT

This article will go over the basics of setting up Unity to use source-control and setting up your first project

Telling Unity you want to use source-control

Within Unity, press Edit > Project Settings > Editor. In your inspector window you will see the Editor Settings for your project, under “Version Control” set the mode to Meta Files.

This will tell Unity to generate a small file for each object in your project (everything; Scripts, Prefabs, Textures, you name it, it metas it). Now, when an asset is modified in the editor, only the asset and it’s associated meta file will report changes, instead of the entire Library folder.

And then Asset Serialization, set it’s mode to “Force Text”. This will output Unity levels as an YAML document instead of a binary file (Pro Only).


Setting up the .gitignore

Unity generates some files that GIT wouldn’t need, for instance the Library folder. This contains GUID’s for each asset within the project, it’s normally packed with hundreds of files that can confuse GIT and lead to merge issues later on. To solve this we simple ignore it!

In the root of your project that you want to source control create a new file named “.gitignore” (Depending on your OS, this file may be hidden so you will need to show hidden files).

Within this file type:


Updated, thanks @tjheuvel

Obviously replacing “[Your_Project_Name_Here]” with your project folder name..


Your first commit

Now you are ready to commit your project to your GIT server (I recommend for this..). Open up your console and type:

cd <project path>
git init
git add .
git commit -m "[Initial project setup]"
git clone --bare . <repository location>
git remote add public <repository location>

Change the repository location to the URL of your GIT repository and you should now be done. Well done you’ve got your Unity GIT repo setup.

Recent posts

  • 29 July 2013 // 0 Comments
    The last 6 months have definitely been a roller-coaster! About this time last year I was just starting out as the Technical Director for Happy Finish, but...
    Read more
  • 02 July 2013 // 0 Comments
    Procedural tree generation inside Unity, I get bored sometimes and like to play around. Click and drag to move around and use the scroll wheel to zoom...
    Read more
  • 11 June 2013 // 0 Comments
    This is a VERY basic overview of how Asynchronous / Synchronous applications work within Unity, for more detailed examples please find the update execution order found here...
    Read more
  • 11 June 2013 // 0 Comments
    MonoBehaviours, What are they? If you have been used to working with JavaScript within Unity you will have already been using them, maybe without knowing. They are...
    Read more
%d bloggers like this: