GitHub
Overview
GitHub is a powerful developer platform that is free to use. It can store your Unity project for multiple machines, multiple team members, and version control. All developers, individual or teams, should use GitHub when building Genies Experiences.
Here are some key features:
- Store project online to be worked on multiple machines.
- Create branches so you can have different versions of the project.
- Collaborate with team members and sync your work together.
Prerequisites
In order to get started with GitHub, there are a few steps:
- Download Git to your computer.
- Visit GitHub and create a new account.
- Download GitHub Desktop to your computer and sign into your GitHub account.
- Have a Unity project with Genies SDK.
Follow the Getting Started tutorial to get a Unity project with Genies SDK.
Create a New Repository
A Git repository (repo for short) is a .git
file inside your project folder that will track changes, keep a history of changes, and handle GitHub actions.
Click the Add Button
Open GitHub Desktop and click the Add button at the top left. Select the Create new repository option.
Add a Name and Description
A prompt should appear for the new repo details. Add a name and description.
Choose the Unity Experience Folder
For the Local path, click the Choose button. Select the Assets > Experience folder inside the Unity project folder.
The Git repository will be created inside the Assets > Experience folder of our Unity projects because developers are required to add all custom assets to that folder anyways. This will also avoid tracking Genies SDK updates and unnecessary Unity data.
Create the Repository
After choosing the local path, click the Create repository button.
Publish the Repository
Click the Publish repository button at the top. Then make sure the Keep this code private checkbox is activated. Click the Publish repository button.
The Repository GitHub Page
After you publish the repository, you can view it on the GitHub website.
The repository page is: https://github.com/{AccountName}/{RepoName}
Add Collaborators
On the repository page, press the Settings tab and open the Collaborators section. Here you can add people and change access permissions.
Clone Existing Repository
Cloning a repository means downloading a published repository to your machine which is required for multiple machines or collaborators.
Create a Dev Kit Experience
Create a new Unity project by following the Getting Started tutorial.
Clone the Repo
Open the GitHub page for the repo you need to clone. Then click the Code button on the repository page. Then select Open with GitHub Desktop.
Choose the Local Path
Once GitHub Desktop opens, click the Choose button for the Local path property. Select the Assets > Experience folder inside the new Unity project folder. Then click the Clone button.
GitHub Tips
Using GitHub can be a little overwhelming for beginners. These are tips to help you get started and avoid mistakes:
- Each developer should create and publish a personal branch when they start working on a feature.
- Make commits and push them often to your branch. This will decrease the chance of losing work.
- Create a pull request for your branch once you complete a feature.
- Make sure to keep your local branches up to date by fetching and pulling often from the origin repository.
- Discuss with team members and reach out for help with merge conflicts.
GitHub Glossary
Here are some key terms when dealing with GitHub:
- Local repository refers to the repository saved on an individuals computer.
- Origin repository refers to the repository saved on Git's database that you can see on GitHub.
- Branch is a new version of a repository.
- Main branch is the stable version of the repository.
- Commit is a new update the local repository.
- Pushing updates the origin repository with the local repository's new commits.
- Fetching checks and gets any new commits from the origin repository that the local repository does not have.
- Pulling updates the local repository with the fetched commits.
- Merge is when a repository is combined with another repository.
- Merge conflict is when a merge cannot be completed, most likely a file that has two conflicting changes.
- Pull request is when a branch is being asked to merge with a main repository.