Git version control for Unity
Welcome to this easy and quick tutorial how to set up Git version control for the unity game engine.
Using Bitbucket and SourceTree
Making things easy, we use Bitbucket for online repositorys and the sourcetree-app to do commits, pulls and pushes.
Make shure to watch the following video, where I teach everything about setting up version control.
After that, don’t forget to set up your gitignore-file for SourceTree, check out the screenshot and description below.
Afterwards don’t forget to include a “gitignore”-file in your project directory.
That way you can make shure that only the necessary files will be uploaded to the remote repository.
All the crap stuff like temp- and build-files etc. will be ignored.
You can create the file by creating a new textfile, using filename “gitignore.txt”.
Copy and paste the following content into the file and save it:
# =============== # # Unity generated # # =============== # [Tt]emp/ [Oo]bj/ [Bb]uild [Ll]ibrary/ sysinfo.txt # ===================================== # # Visual Studio / MonoDevelop generated # # ===================================== # [Ee]xported[Oo]bj/ /*.userprefs /*.csproj /*.pidb /*.suo /*.sln* /*.user /*.unityproj /*.booproj # ============ # # OS generated # # ============ # .DS_Store* ._* .Spotlight-V100 .Trashes Icon? ehthumbs.db [Tt]humbs.db
Than rename the file and delete the “.txt”-fileending. There you have your gitignore-file:
Since SourceTree uses its own gitignore-file, you have to tell SourceTree to use your gitignore-file.
SourceeTree -> Tools -> Options -> Git shows the git ignore file location it uses. You can also edit the file from a button in that dialog.