HoloLens Tutorial – Source Control

Last Updated: Apr 18, 2017

Tutorial Accomplishments

  1. Setup a Git Repository
  2. Initial Checkout
  3. Create the .gitignore file
  4. Configure the Unity Project
  5. Initial Commit and Push

Setup a Git Repository in VSO

For the remainder of this tutorial I’ll use the GIT source control provided by Visual Studio Online because it is free and well integrated into Visual Studio.  GitHub is another option that could easily be used for a very similar workflow and has decent integration into Visual Studio as well.  After you have created and/or logged into your VSO account, select New under the “Recent projects & teams” section of the page.  Use this dialog to create a team project using the “Scrum” process template and “Git” version control.  I used the following settings:

1

Click Create project, and for the project creation to finish.

 

Initial Checkout

Click Navigate to project:

2

Select Code from the top menu and you will see the project’s empty repository.

Open Visual Studio and find Team Explorer.  Select Manage Connections and connect to team project. Add the VSO server which is in the form of .visualstudio.com find the check box next to the project you created and enable it.  This should look something like this:

3

Click Connect which returns you to team explorer.  Select Manage Connections again and select the project that you just created and connected to:

4

Click Clone this repository and select the folder where you want the code, this should not be the folder where the existing project is located!  This results in the creation of a folder with just a .git folder:

5

Create the .gitignore File

Move the entire contents of your unity project into the folder that was created when the repository was cloned.  My folder looked like this:

6

In Visual Studio Team Explorer you will immediately notice team explorer reacting to the code by showing available solutions to open.  For now ignore that and click Changes.  Visual Studio/git will detect that a bunch of files are ready to commit:

7

In my case over 3000 for a simple project that does nothing. We don’t want to add all of these files to source control because they are files that can be regenerated at any time. What are each of these folders for?  The App folder has the built Visual Studio project.  Since this was generated we don’t want to source control the contents of this folder. The Assets folder contains all the assets of the project this is very important to keep in source control.  The Library, Temp, and UWP folders all are generated at build time and should not be in source control. The ProjectSettings folder contains all of the settings configured in Unity 3d and should be in source control.  To tell git which files not to place in source control we create a “.gitignore” file. In the root of  your project folder create an empty txt file called “.gitignore” and open it in your favorite editor:

8

Insert these contents into your .gitignore file.  Save your .gitignore file. In Visual Studio the changes ready to commit should change to only the files that we eventually want to check in:

9

Configure the Unity Project

Open the project in Unity. Open Edit -> Project Settings -> Editor.  Set Version Control mode to Visible Meta Files and Asset Serialization to Force Text.  Your settings should look something like this:

10

These changes are automatically saved.  Close Unity 3d.

Initial Commit and Push

In Visual Studio go to Team Explorer and select Changes if you are not already there.  Enter a comment:

11

Click Commit All.  You have now committed those changes to your local repository. Click sync to go to the synchronization screen of team explorer and sync again to upload that commit to the remote repository.

12

At this point the project has working source control.  Since this is not a source control tutorial series this will be the last mention of source control.  When you would like to check in changes to source control simply commit changes locally and sync them to the remote server.

Tutorial Index

  Versions: Unity 2017.1.0p5 | MixedRealityToolkit-Unity v1.2017.1.0Visual Studio 2017 15.3.2
Unity 3D Project Creation How to create a HoloLens project in Unity 3D
Source Control Configure git for HoloLens / Unity work
Spatial Mapping How to spatial map a Room
Object Surface Observer Set up fake spatial map data for the Unity editor
TagAlongs and Billboarding   Tag along instructions to the user to force text on screen
Spatial Understanding Add spatial understanding to get play space detail
Finalizing Spatial Understanding Complete Spatial Understanding and Input Manager
Object Placement and Scaling Find valid locations for holograms in the play space
Hologram Management Manage the holograms you want to place in the world
Cursor and Voice Add a cursor and voice commands
Occlusion Add occlusion with the real world to your scene
Colliders and Rigidbodys Add Colliders and RigidBodys to your holograms

One thought on “HoloLens Tutorial – Source Control

  • Posted on August 10, 2017 at 6:08 am

    Great walkthrough on git and Unity projects.

    Reply

Leave a Reply