Skip to main content
  1. Learn
  2. Software Development
  3. Guides
  4. Git tutorial
  5. Git collaboration
  6. Branches
  7. What is a Git branch?
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

What is a Git branch?

Branches in Git are independent lines of development within a repository. Each branch represents a snapshot of the project's files at a certain point in time. When you create a new branch, it initially contains the same commits as the branch you created it from.

Diagram of git branches.
A git branch is an independent line of development taken from the same source code.

Separate branches can be merged into one branch. The diagram below illustrates how development can take place in parallel using branches.

Diagram of multiple projects.
Multiple development projects are taking place using the same source code.

Changes in the primary or other branches will not affect your branch unless you pull the latest changes from those branches.

It is a common practice to create a new branch for each task (i.e., bug fixes, new features, etc.). This method lets others easily identify what changes to expect and simplifies backtracking.

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life