Branches — Working in Parallel
How developers work on new features without risking the stable version of the project.
What is a branch?
A branch is like making a photocopy of a document to try edits on. You take the original report, photocopy it, and start rewriting the introduction on the copy. Meanwhile, the original stays safe on your desk. If the rewrite works out, you replace the original. If not, you bin the copy. The original was never touched.
In Git, a branch is a separate line of development. It starts as an exact copy of the project, then evolves independently. When the work is ready, it gets merged back into the original.
The main branches
Most projects have two permanent branches:
main
The production version — what is live and running. Think of it as the published edition of a book. Only thoroughly reviewed work goes here.
develop
The integration version — where finished features are collected before release. Think of it as the editor's draft that combines all the approved chapter rewrites.
Feature branches
When a developer starts working on something new, they create a feature branch. This is a temporary branch that exists only while the work is in progress. Feature branches are typically named descriptively:
feature/dark-mode— adding a dark mode optionfeature/mesh-hub-v0.2— version 0.2 of the Mesh Hubfix/login-crash— fixing a specific bugfeature/physics-controls— adding physics simulation controls
How branching works visually
Two feature branches are created from develop. Each one is worked on independently,
then merged back. When develop is stable, it merges into main for release.
The lifecycle of a branch
The life of a feature branch: create it, work on it, get it reviewed, merge it, delete it. If the review finds issues, the developer goes back to make more changes.
When should a branch be created?
New feature
"I want to add a chat sidebar to the app."
Bug fix
"The login button crashes on mobile — I need to fix that."
Experiment
"Let me try a different layout and see if it looks better."
Refactor
"The code works but it is messy — I want to reorganize it."
What about merge conflicts?
A merge conflict is like two people editing the same sentence in a shared document. Person A changes "The sky is blue" to "The sky is grey". Person B changes the same sentence to "The sky is orange". Git does not know which version to keep, so it asks a human to decide.
Merge conflicts are normal and not dangerous. They just mean two branches changed the same part of a file, and Git needs a human to choose which version is correct. Developers resolve these routinely.
Real BACON-AI example
The BACON Mesh Hub project currently uses this branching structure:
Real branches from the BACON Mesh Hub project. The feature/mesh-hub-v0.2
branch added a WhatsApp-style input bar, while feature/physics-controls
added physics simulation controls — both developed in parallel.
Key takeaways
- A branch is a safe copy of the project for trying new things.
mainis the live version;developis the staging area.- Feature branches are temporary — they get merged and deleted.
- Merge conflicts are normal, not dangerous.