My git Strategy for New Unity HoloLens Projects
The MRDesignLabs github repository is a powerful tool for building apps on the MS HoloLens device. It’s basically a work-in-progress Unity library, with usable components that allow you to get up and running quickly for HoloLens development. Soon it will have tools for a broader range of Windows Mixed Reality devices including VR, but for now, the repo gives you a head start creating things like simple menus, object collections, buttons, interactable objects, and other common elements for the HoloLens.
It took me a few tries to start using the MRDesignLabs git repo effectively. Below is the git strategy that I now use for starting a brand new project. I hope you find it useful.
Forking the Project
Let’s say I want to use the Unity tools in the available MRDesignLabs_Unity repo as a starting place for creating my very own HoloLens App.
The first thing I want to do is fork the MRDesignLabs project from https://github.com/Microsoft/MRDesignLabs_Unity
Note that fork is different than clone or even branch. Fork tells github that you want to take the entire project (as is) from the Microsoft gitHub repository, and transfer it to be a project on your own gitHub account. (Many people want to clone, or branch, the project to start working on it, but that’s less useful than forking in order to extend from the foundation.)
Clone (after Fork)
After forking the project, simply clone it to your local machine. In a command line navigate to the directory where you would like the project to live and type ‘git clone’ followed by the url.
Now I (or my team and I) can work on the project. When we push and pull, we don’t effect the creators of MRDesignLabs_Unity with our updates.
Initializing and Updating the Submodule
Once I have forked the project from Microsoft’s github repo, and cloned it so that it exists on my local machine, there’s the small matter of setting up and updating the submodule from time to time. There are clear instructions on the MRDesignLab_Unity page for this.
*If you’re not familiar with submodules, they are a separate git project inside of your git project. They have their own git history. They are very useful for things like libraries that need to be updated on a different schedule than your project.
After taking the steps pictured above on the command line, you can confirm that your submodule is up to date by opening your Unity project and navigating to MRDesignLabs_Unity/Assets/MRDesignLab/
If you successfully initialized and updated the submodule, you will see content inside this folder.
Now you are setup with your own Unity project for HoloLens. When you (or your team mates/collaborators) make commits and push them, the commits will update your git project. When you want to make sure you have the most up-to-date tools, simply update the submodule by navigating into it in a command line, and typing ‘git submodule update’.
Updating the Unity Library for HoloLens
In the event that you’re a black-belt programmer and want to update the actual library/submodule to extend the core functionality, you would branch from MRDesignLabs_Unity_Tools, make your changes to the library, and then submit a “pull request.” The MRDesignLabs team will then review your changes and make a decision about incorporating them into the project on github.