[S-Git-002] Git Branching Standardization
In this article:
Standard Brief
Our Git Branching standard is enforced to ensures consistent workflow every time. Uniformed and standardized approach will help save time, simplify things, and prevent any confusion in your quest’s day-to-day
Scope
This standard cover the usage of branching in Git. This standard applies to all crew that use git in their day-to-day workflow. This page doesn’t talk about how to use Git. For how to use Git, please go to [PR-Git-2021] How to use Git for day-to-day operation.
Standard Element
Git Concept Crash Course
Git vs GitLab vs GateGit
- Git is the software used to keep track of project files. Git is free and can be used by anyone
- GitLab is simply a platform that use Git software. GitLab host Git on the internet so you can collaborate remotely with your team
- GateGit is a hosted service where Agate’s repositories lives. GateGit uses GitLab and is for internal use only
Why do we use Git?
-
Git allow us to easily synchronize changes so you and your team can work collaboratively on the same repository
-
What is repository?
Repository is a storage where the project files live. Easier way to understand it is that it’s like a folder in a Google Drive that stores the files you are working on. That folder can be called repository, which is hosted on Google Drive. In GateGit case, the project files is stored in a repository hosted in GateGit
-
-
Git allow us to keep track of every changes made to every files in our project, which helps us:
-
stay organized
-
see what changes were made, when was it made
-
like if you changed an image
-
with a timestamped changelog
-
-
allows us to revert changes to previous version (this is why it’s called Version Control software)
-
Git Add and Git Commit
Let’s say you are changing something in the project file. You’ve finished with your work, and you want to save it. To do that in Git, you first have to “add” the changes into what is called a “staging area”, kind of like registering to the system “here, this is the list of files I want to save.” After you add the changes, you “commit” them to Git. The commit basically act as a save point.
Git Branch
Let’s say you and your lead is working on a project. You want to add a new button next to an existing button. You directly change the file to add the button. Turns out you made a mistake and mess up the whole layout! Before you can fix your mistake, your lead take a peek at the main project file. Oh no! Your lead is now mad at you for messing everything up in the main project file! Why did you do this?!
With Git, this can be easily avoided by branching like a tree. The concept is you make a branch of the main project file. In this new branch, you can safely add the button there without the fear of messing up. Well, maybe you still mess up the layout even this time, but it is isolated and the main file is unaffected. You can change and test the button until you get it right, and maybe show it to your lead for review.
So, how does that work, technically? The “main project file” we talked above is called the main branch or master branch. You can create (virtually infinite) new branches to do your work without directly affecting the main branch. Usually, each branch is associated with a distinct feature or issue that need to be fixed.
Example of branching
When all is well, you can commit your change, then merge it to the main branch! This way, the main branch is always the clean branch where everything works.
Git Merge
With the scenario above where you work on a new button in a new branch, let’s say you are sure that your work is done and everything is working as intended. You now want the new button in the main branch. To achieve this in Git, you do what is called Git Merge. Git Merge is essentially merging your button branch into the main one, applying all the changes you did. Now, you have the new button in the main branch!
Example of merging
Git Pull and Git Push
So far the concept we talked above are applied to local repository. But what about remote repository, where they lives in the cloud? Git Pull and Git Push is the answer. With Git Pull, you can “download” a remote repository into your device so you can work on it. With Git Push, you can “upload” what you have been working on your device into a remote repository, making your changes available for the team (which they can pull to collaborate).
Branching Standard
Important!
- All changes and commits must be a merge request
- Feature and bugfix branches must be created from issues
Responsible for Issue Creation:
- Lead Programmer: create issues for a feature or bugfix, so that the programmer can work on it
- QA Team: create issues for bugs found during/after testing
- Stakeholders (Product Manager, Tech Advisor, Producer, Lead Programmer): creates issue based on needs and importance
Branching Model
Branch | Naming | Usage | Branched from | Responsible |
---|---|---|---|---|
master | master | The main production branch, contain production-ready state. Base for latest release version | - | Producer |
develop | develop | Base for ongoing development version | master/main | Lead Programmer |
feature | feature/[issue-name] | Implement feature of [issue-name] | develop | Assigned Programmer |
bugfix | bugfix/[issue-name] | Fix bug of [issue-name] | develop, feature | Assigned Programmer |
hotfix | hotfix/[ver.number] | Hotfix for stable version of [version_number]. Example: hotfix/0.5.1 | master/main | ? |
art | art | Git branch for storing your images in the repo | master/main | Artist |
design | design | Git branch for storing design | master/main | Designer |
Branching Systems
- Tech/Programmer: as different programmer can collaborate parallelly on the same piece of code or script, programmer should always use branching system. Branches are differentiated by each feature and bugfix (dictated by issues created).
- Art & Design: as different artist or designer most likely will not be collaborating on the same piece of asset, they can use a branch for the whole asset/design instead of creating multiple branches per feature like programmer does. This is called trunk system, where every changes happens in a singular branch.
No Comments