How to Git in Unity- part 4

Previous article: How to Git in Unity- part 3

Since we successfully connected our local files to github, now we can use branch.

Branches are commonly using for different part in a project. For example, if your team are in develop with a racing game, there might a branch for modeling, car function scripting, or game system building. Branch can help each part or group to develop alone but also can be merged when in need.

To create and switch between branches by the following steps:

  1. Name your new branch in console:
    git branch <branch name>
  2. Switch to new branch by using switch or checkout:
    git switch/checkout <branch name>
  3. Your current branch will show on the right in blue.
create new branch dev and switch to it

4. We can create multiple branches and check all the branches:

create multiple branches

5. While we switch to new branch and make some changes.

switch to branch dev
create a new script named DevScript

6. Add the changes and commit to new branch.

add all the changes and commit

7. Then switch back to main and you’ll notice the script is gone.

switch back to main
the change is gone in main

Now we have multiple branches with different process, we can use merge to stick them together. When a work is reaching some big section, such as prepare for publish or release the alpha version. Use merge to collect all the works is fast and easy.

1.Switch to the branch that you want to create something.

switch to new branch inventory
add another script

2. Add all the changes and commit.

add all the changes and commit

3. Switch back to the branch which we want to merge others in by using:
git merge <branch name>

merge inventory to dev

4. We can push our new branch.

push dev as a new branch to origin

5. Now you got 2 branches as I do.

2 branches now!

Next: How to Git in Unity- part 5

--

--

--

A passionate gamer whose goal is to work in video game development.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Generate 97% of your Spring JPA MVC code

Setup of persistent docker node on ARM M1 MacBook

Funds Investment Analysis

image.png

Revealed- Best Flutter App Development Companies & Their Benefits

Why Cloud Composer Should Be The Only Way You Run AirFlow

Improved Lightning External Loggers

Dynamic configuration management and circuit breakers in Kubernetes

Want to know the easiest way to save time? Use `make`!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
S.J. Jason Liu

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.

More from Medium

Unity : Raycast (Part II)

Custom Dynamic Ambient Systems

Damage VFX using Animated Sprites in Unity

Creating a Simple Cooldown System in Unity Using Time.time