How to Git in Unity- part 3

You can review the previous articles here:
Part 1, Part 2

Before we start to commit and push our update. We need to follow the steps to do it right in version control.
While a project is sharing between all the co-workers, some changes might lost if we didn’t follow the steps properly.
Always do the version control by:

PULL, COMMIT, PUSH
Make sure you pull the latest version of changes, then commit your part, then push it to repository.

Now we’re going to push our local files to repo.
As I mentioned in the previous article, we need to make the branch to main(which is default as master) first to prevent error.

1.We can create new branch by input:

2. With same namespace, it should be error free to pull from remote repo:

3. You can always check the status by the command:

The red parts show the local changes different from remote repo.

4. Add all the changes to be pushed by input:

the period is the key which means “add all the files”.

5. Then we can push our changes to repo:

6. After pushed, we can delete the empty branch “master”
Before we do it, we can make sure the current branches:

It should reveal 2 branches, main(with star mark) and master.

7. Now you can delete branch master:
(upper letter D to force delete)

That’s it! Now you successfully push the branch “main” and without any error.

Next: How to Git in Unity- part 4

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