003 — Git Branches
Git Branches
You can think of these as timelines running parallel to each other. They allow developers to safely work on different aspects of their game (and/or software) with mitigated risk of fouling the whole thing up.
Commonly, it’s good to use two primary branches: the dev branch and main branch.
Dev branch: where the game or program is being developed and actively worked on.
Main Branch: where everything comes together for building the final product.
Say a bug is discovered in the code — it’s more likely to be found in the dev branch instead of the main that’s being released to the public. This way your team isn’t putting out buggy code.
Coming from a video game context, let’s say we’re working on an RPG. We can make different branches for the different systems: a quest branch, a magic branch, a combat branch, an inventory branch; branches for the overworld and branches for locations.
**git branch**
lists out available branches. The branch with the asterisk is the one you’re in.
To switch to a new branch, type
**git checkout [branch name]**
Anything done in one branch does not affect anything else in the other branches.
To make a branch in Git use the following command:
**git branch [name of new branch]**
Once created, type
**git branch**
to see your list,
Next up, we’ll look deeper into switching around between branches.