Unity version control with git.

Using version control is a the best way to guarantee that your code is safe and have access to older versions of the code.

In this post I will show you how to setup unity to work with git.


You need Unity 4 or higher for this to work. (I didn’t test it with a version lower than 4) and a git client.

Setting up Unity:

What we need to do with is to tell Unity to use text based visible meta files.

  • Create a new project.
  • Go to Edit -> Project Settings -> Editor


  • Change Version Control Mode to from Hidden Meta Files to Visible Meta Files and the Asset Serialization Mode From Mixed to Force Text.


Setting up git:

Now that Unity is configured we need to tell git to ignore some files that Unity generates automatically. This will make sure that the size of the git repository is minimum and prevent some of the conflicts.

To do this we need to add a .gitignore file at the root of our project (not inside the assets folder).

  • Use your favorite git client to create a git repository in your project directory.
  • Go to your project directory (which should contain .git folder now) and create a new file. Name it .gitignore.

The .gitignore file content:

# =============== #
# Unity generated #
# =============== #
# ===================================== #
# Visual Studio / MonoDevelop generated #
# ===================================== #
# ============ #
# OS generated #
# ============ #

GitHub repository:

I have created GitHub repository containing an empty Unity Template.



That is it. Now you’re set to use Unity with git.