Using Unity with Git, made painless for everyone.

GitMerge for Unity is a free, open source Unity Editor tool that allows you to merge scene and prefab files. This solves the main problem you currently get when using Git to work with Unity.

About

Unity offers a few solutions for collaborative teamwork. These do not necessarily stick to the standard you're used to. So... why not use Git?

You'll have to take these two things into account in order to get started:

  1. Setup a good .gitignore, like this one.
  2. Get yourself a mergetool for scenes and prefabs.
    That's where GitMerge for Unity is supposed to come in.

GitMerge for Unity is licensed under the GPL2.0 license.

How to Install

Recommended: Use Unity's package manager

The recommended way to install GitMerge for Unity is to copy the git url and paste it into the package manager.
How to add a package via git url

Alternative: Clone into Assets

Alternatively, just clone the repository into your Assets Folder.

How to use

GitMerge for Unity is an open source software and is constantly being developed. If you find something that could be improved, please feel free to help!

Start merging

GitMerge for Unity comes as an opt-in merge tool. It is not integrated into Git as an automatic merge tool since merging scenes and prefabs is something you'd usually not want to have done automatically.

First off, you create your merge conflict the way you usually do. Once you're in Git's MERGING state, open the GitMerge window in Unity (Window → GitMerge). Then, drag the scene or prefab you want to merge and drop it into the big box.

This is what a scene merge situation can look like.

The BoxCollider component of the "Cube" GameObject has been automatically merged to the default setting ("keep it").
The user has decided to use "their" version of Transform.LocalPosition, but "our" version of Rigidbody.Interpolate and BoxCollider.IsTrigger.
The other two conflicts have not been addressed yet.

Solving Merge Conflicts

The tool will find the differences between the "our" and "their" version of the scene/prefab. You will get a list of so called "MergeActions" in the tool window. Each MergeAction solves one point of conflict between the two scenes.

To do solve the conflict bit by bit, you will be offered two to three options for each MergeAction:

You can choose to click the left button to use "our" version, the right button for "their" version, or enter a new value in the middle. Either way, the MergeAction line will turn from red (unmerged) to green (merged). MergeActions that have been automatically merged to a default (like keeping a Component that "their" version doesn't have) are marked yellow.

You can continue to edit the scene in a normal way during merging. It is not recommended to delete GameObjects that might be part of a MergeAction though. Consider merging first, and apply changes to the GameObject hierarchy afterwards for a new commit.

When all MergeActions are flagged as merged, you can click on "Apply merge".
The scene will be saved and marked as merged for git. Since there could be more merge conflicts, the button will not automatically create a commit.
You'll have to commit your merge manually at some later point.

Active development

GitMerge for Unity is an open source tool that is being actively developed. You can head over to the project page, check out issues, fork, and make pull requests.
If you find a bug or something to improve, but cannot fix/implement it yourself, feel free to tell me about it.

To see what's up next, have a look at the project's issue page.