Back to glossary

Term

Git Branch

A branch is an independent line of development in a Git repository — a moving pointer to a commit, allowing parallel work without conflicts with the main code.

Git Branch — explained in more detail

Technically, a branch in Git is just a lightweight pointer to a commit — not a copy of the code, but a 41-byte reference under .git/refs/heads/<name>. That makes branches in Git extremely cheap: creating, switching, deleting all happen in milliseconds.

What branches are used for

  • Feature branches: every new feature gets its own branch, isolated from main.
  • Bugfix branches: short-lived branches for quick corrections.
  • Release branches: stabilise code at a defined state before shipping.
  • Long-running branches: parallel versions like develop, staging, production.

Typical workflows

  • Trunk-Based Development: short-lived feature branches, everything flows back into main quickly.
  • GitFlow: separate develop, release and hotfix branches — more structure, more overhead.
  • GitHub Flow: a single main, everything else is a short-lived branch with a pull request.

In the AI coding workflow

AI tools usually create a dedicated branch per task — so main stays runnable at any time, and failed experiments can be discarded simply by deleting the branch.

Entdecke mehr