Unity with git for external version control

Hello! I’m trying to use git for external version control with Unity Pro. I found this page in the manual, which gives a list of Library files that should be tracked. But I notice that the manual page was last modified about a year ago (2010-08-10), and I’m running Unity 3.4 (which was released later). Does anybody know if the manual’s list of files-to-track is up to date? I’m wondering about files like BuildPlayer.prefs, EditorSettings.asset, EditorUserBuildSettings.asset, and others.

Also, does anyone know if *.unityproj files should be version tracked?

(Although I’m using git, I expect the same question would be applicable to users of svn, Hg, or other version control systems.)

Thanks in advance!

The information on that site should still be accurate. You should probably add the *.unityproj files and everything else in the directory you want to version control(except the obj and Temp directories). Though neither GIT nor any other version control system can do any accurate checks on files that aren’t plain text.

Thanks, PaxNemesis! I also have some *.sln files in that directory, which I assume are MonoDevelop solution files. I’ve read that those should also be ignored by version tracking. Have you heard differently?

In case you’re interested, git is reasonably smart about binary files. It can be configured (1) not to diff them, (2) to use an external diff tool, (3) to convert them into text files before diffing them (depending on the file type, of course), etc. It’s pretty handy. See here for details. There’s even an extension called git-media that lets you use git to version track your big binaries while storing the binaries themselves outside of git, which keeps your repos lean and fast.

I know this is a bit late, but have you tried using Git UniTEAM from the Asset Store? It’s an editor extension that lets you manage your Git versioned project.

I don’t version control *.unityproj (or .csproj) because I know MonoDevelop can recreate those when not found. Those files are only used by MonoDevelop, and it’s entirely optional to use MonoDevelop when coding for Unity anyway (I just use other text editors). So I don’t like putting that in.

They’re not really critical, and you won’t lose anything if you don’t include it in version control. AFAIK .unityproj is simply a list of .js files in your project, so MonoDevelop can show a listing of them in its IDE. You can recreate/refresh that file by going to the Unity Editor then click Assets > Sync MonoDevelop Project.

There are other files that MonoDevelop creates, like session files that say what files were last opened, so MonoDevelop can open them when you run it again. You surely won’t want to version control those.

I use the following .gitignore and it works pretty well. You’ll have to make your own decision about .sln and .csproj. I like including them, but they are not necessary since they are auto-generated. However, with the .sln since I use UnityVS it’s best to commit to save some of the settings.

# Unity Builds (save on storage space)

# ---------------[ Unity generated ]------------------ #

# Unity/*.sln
# Unity/*.csproj

# Unity crash handler generates

# ----[ Visual Studio / MonoDevelop generated ]------- #

# UnityVS generated from .pdb files

# -------------[ OS generated ]------------------------ #

# Vim generated? Not sure