This makes merging changes possible and allows Git to store changes as smaller deltas instead of a full copy of the file to save storage space. The Asset Serialization setting ensures that Unity stores its asset files as text instead of binary. The command-line Git client will still find these files, but making them visible will ensure that other clients don't have issues finding them. meta files that Unity creates alongside all asset files and directories are not hidden on disk. The Version Control setting simply ensures that the. The following settings are the default in newer versions of Unity, but it's still worth a quick check to make sure they're configured correctly. There's a minimal amount of configuration required when using Git in a Unity project.
Note: I'll be using the Git command-line client (MinTTY) for Windows for the rest of the article. This article covers initializing a new project using Git with Large File Storage (LFS) to handle the substantial number of binary files required by game development. You can do this either with your editor, or on the command line.Using Git for version control in a Unity project requires a small amount of initial setup, but it can all be done quickly using the command-line client. Now that I have all three tools set up, I can switch between them just by changing the value of the tool line of the or section. The correct order of parameters that kdiff3 likes.) ( If you’re wondering why kdiff3 got away without including all those command line parameters, it seems that git is biased, and natively knows tool = p4merge tool = p4merge keepBackup = false cmd = C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe \" $LOCAL \" \" $REMOTE \" cmd = C:/Program \\ Files/SourceGear/Common/DiffMerge/sgdm.exe -merge -result= \" $MERGED \" \" $LOCAL \" \" $BASE \" \" $REMOTE \" trustExitCode = true cmd = C:/Program \\ Files/Perforce/p4merge.exe \" $LOCAL \" \" $REMOTE \" cmd = C:/Program \\ Files/Perforce/p4merge.exe \" $BASE \" \" $LOCAL \" \" $REMOTE \" \" $MERGED \" trustExitCode = false cmd = C:/Program \\ Files/KDiff3/kdiff3.exe cmd = C:/Program \\ Files/KDiff3/kdiff3.exe trustExitCode = false To set up your external merge tool, you’ll need to add some lines. Seems dumb, but this order makes more sense to me in understanding how the file works. I’m going to describe the sections we need to add in the reverse order of how you most often see them in the file. ini file, because it pretty much is just that. You’ll notice that this thing looks like a plain old-fashioned. gitconfig file sitting there (I’m also assuming you already have git installed). So if you open upĬ:/Users/yourusername, you’ll see a. gitconfig file lives in your home directory (I’m going to assume you’re running Windows here). The command line is great, but in this case, I think it’s easier to just open the. Your external diff and merge tools for git.
If you go searching, the web will turn up all kinds of hits that will tell you how to run git config -global blah blah blah to set up The common ancestor file, and on the bottom, a pane where you do the merging.
(It shows you the local file, the file you’re merging from, This seems to be the most up-to-date tool in the list, and I like the 4-pane view.
The UI takes a few minutes to understand, but When the installer asks which applications you want, turn off everything but p4merge.Īny of these tools will work great for you, but I like p4merge the best nowadays. To get to the bits from that link, scroll down to Helix P4V: Visual Client. Part of the Perforce distribution, but git doesn’t mind if you use tools from another SCM. There are quite a few out there that have garnered a fair sized fan base.īuilt in linux for linux ported to windows as kind of an afterthought.īuilt by the sourcegear folks I used this one fairly heavily for a while. Sure, you could just open up those files and grind through the conflict markers like a boss,īut if you’re like me, you’ll probably want something a good bit more helpful.Įnter the visual merge tool.
Visual Studio Code, you’ll probably find yourselfĪ little bit frustrated when you get ready to merge some code and git tells you there are conflicts. However, if you’ve ventured outside that comfortable old tool, and you’re using a light-weight editor like If you are using Visual Studio, then you already have a great tool at your disposal–that venerable behemoth pretty much has everything sewn up. Here’s how to get rolling with a good visual merge tool for git.