Skip to content

This is a repo set up w/ proper gitignore and project board for a game development team using Unity

License

Notifications You must be signed in to change notification settings

colinwilliams91/unity-game-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

unity-game-template

This is a repo set up w/ proper gitignore and project board for a game development team using Unity

How to hook up Unity to Git/GH

  • Make a Repository on GitHub (GH)
    • If you aren't using a template, make sure you select "Unity" .gitignore
  • Make a new project from Unity Hub (UH)
    • Make the name of the project the SAME as what the cloned down repo will be (should just be the name of the repo (sans-"main"))
  • Create a script in your new Unity project (within Unity) to open it with VS by double clicking it
  • Open a terminal in the root folder in VS (your unity proj)
  • Run git init to initialize a git repo inside of it
  • Create a main branch if it isn't autogenerated from git init
  • Run git remote -v to see if origin has been created automatically or not...
  • If it HAS:
    • Run git remote set-url origin https://gihub.com/your/repo.git
    • to set the remote URL for origin to your clone URL for the GH repository
  • Perform ONE of the FOLLOWING (A or B):
  • A:
    • Run git pull origin main
  • B.1: (if you have anything in your Unity git repo that you need merged with the remote repo)
    • In the terminal where you ran git init (the root of your Unity project) run git checkout main (if you are not already in main)
    • Run git branch -m main-holder to rename this branch temporarily
    • Run git fetch
    • Run git checkout main
    • Run git pull origin main this will create a local main that matches the remote main and sync
    • Run git merge main-holder --allow-unrelated-histories to merge anything you need from your local Unity project
    • If any of the above steps fail and you don't want to debug... (experimental)
  • B.2: (only if B.1: has failed)
    • In a new terminal or system explorer Navigate to the parent folder where your Unity project sits.
    • Run git clone https://gihub.com/your/repo.git
    • In the terminal where you ran git init (the root of your Unity project) run git checkout main (if you are not already in main)
    • Run git merge ../your-cloned-gh-repo/main --allow-unrelated-histories to merge the main from your local version of the remote GH repo into your local Unity project git repo you created
  • Handle the merge into your Unity Project's git repository where the C# scripts will now be added by default from within the Unity Editor

Git Workflow

  • 📌Clone down the organization's repo as your origin ("the trunk" | "the org repo" | "org remote" | "origin")
    • This should probably be done as a .zip
  • 📌Pick up a Ticket from the Project Board
    • Assign yourself to the ticket and move it into the "In Progress" lane
    • Create a branch directly from that ticket's full view on GitHub
  • 📌Fetch from origin main (paste what you copied) in your IDE and checkout your new feature-branch which should share the same name as the issuing ticket
  • 📌Use Semantic Commit-Messages for feature development
  • 📌Push your feature-branch to the trunk remote git push origin feature/ticket-branch
  • 📌PR Workflow
    • 📝Author: PR to main for Code Review
      • 🔎Reviewer: "Approval" is required - this means acknowledging what the push will change
    • 📝Author: merges into main
      • 🔎Reviewer: checks out main and builds in Unity from new main
      • 🔎Reviewer: tests in Unity
      • 📌Once tested, notify 📝Author of approval
  • 🎇PR to prod and merge