What is a Git Branch?

A Git branch is an independent line of development within a repository. It allows developers to work on new features, bug fixes, or experiments without affecting the main codebase.

Instead of everyone modifying the same files simultaneously, each developer works in their own branch. Once the work is complete and tested, it can be merged back into the main branch.

Why Branches Matter

Common Branch Types

Main Branch (main)

Development Branch (develop)

Feature Branch

Created for developing a single feature.

Example: