Skip to content
BENIBIX Learn

Feature Branch

Development🔀 Version ControlBranches and History

Also known as Topic Branch, Feature Branches, Feature Branch Workflow

A short branch for one piece of work, merged back when it is done.

Think of it like

Think of it like a side room where you build a model. When it is done, you carry it to the main hall.

Example

Jack makes a branch called add-dark-mode. Two days later it is reviewed, merged into main and deleted.

Why it matters

Many people can work at once without breaking main for each other.

Definition

A feature branch is a branch made for one piece of work. You start it from the main branch and commit to it freely. Main stays safe while the work is half done. When the work is ready, a pull request merges it back. Then the branch is deleted.

Example code

console
$ git switch -c add-dark-mode
Switched to a new branch 'add-dark-mode'
Make the new branch and move onto it in one step.
A feature branch splits off main and comes back when done.

Common mistake

Keeping a feature branch open for weeks. The longer it lives, the bigger the merge conflicts.

Key takeaways

  1. 1
    One job each. A branch holds one piece of work.
  2. 2
    Keep it short. Merge in days, not weeks.
  3. 3
    Delete after merge. Old branches only add clutter.

Learn it properly