# Feature Branch

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

**Field:** Software Development  
**Category:** Version Control  
**Also known as:** Topic Branch, Feature Branches, Feature Branch Workflow

## 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.

## 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

Jack makes a branch called add-dark-mode. Two days later it is reviewed, merged into main and 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.

## Why it matters

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

## Common mistake

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

## Three principles

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

## Related terms

- [Branch](https://learn.benibix.com/term/development/branch)
- [Main Branch](https://learn.benibix.com/term/development/main-branch)
- [Pull Request](https://learn.benibix.com/term/development/pull-request)
- [Merge Conflict](https://learn.benibix.com/term/development/merge-conflict)
- [Squash Merge](https://learn.benibix.com/term/development/squash-merge)

## Taught in

- [Git Branches and HEAD](https://learn.benibix.com/learn/development-version-control/git-branches-and-head): Git and GitHub, 4/13

![A main branch runs along the top. A feature branch splits off it, gets two commits, and comes back three ways. Fast-forward: main had no new commits, so its label just slides forward to the feature's last commit. Squash merge, lit up: the two feature commits become one new commit on main. Merge commit: a new commit with two parents joins both lines.](https://learn.benibix.com/diagrams/dev3-branch-merges.svg)

---

Source: https://learn.benibix.com/term/development/feature-branch
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
