Branch (Git)
What Is a Branch?
A branch in Git is a movable pointer to a commit that marks an independent line of development. Creating a branch copies no files. Git only writes a new reference, so developers can start a branch in an instant and work without changing the main code.
Why Branches Matter
Branches let several people change the same codebase at once without breaking each other's work. The cost appears when a branch lives too long. A feature branch that stays open for three weeks drifts away from main, and the eventual merge brings conflicts, a huge pull request and a risky release. Short branches merged within a day or two avoid all three.
How a Branch Works
Every commit in Git points to its parent. A branch is a named reference to the latest commit on a line of work, and it moves forward with each new commit. HEAD points to the branch that is currently checked out.
A typical workflow has four steps. The developer creates a branch from main with git switch -c feature/login. The developer commits to that branch and pushes it to the remote. A pull request proposes merging it into main. After review and passing checks, the branch is merged and deleted.
Teams choose a branching strategy on top of this. In trunk-based development, branches last hours or a few days. In GitFlow, long-lived develop and release branches sit beside main. Branches belong to the coding stage of the software delivery lifecycle.
Branch vs Fork
A branch is a line of development inside one repository. A fork is a full copy of a repository under another account, with its own branches. Teams inside a company normally use branches, while open-source contributors without write access use forks.
How Oobeya Uses Branches
Oobeya analyzes repository history under Analytics > Coding, Review & Delivery, with Git Analytics, Pull Requests and Deployments (DORA) tabs per repository. Branch habits show up in two DORA numbers. Lead time for changes starts at the first commit of a change, so long-lived branches raise it. For change failure rate, Oobeya detects hotfix naming patterns in branch names and marks the deployment before the hotfix as failed.
Frequently Asked Questions
What is the difference between a branch and a tag in Git?
A branch moves forward with every new commit. A tag is a fixed label on one commit, typically used to mark a release.
How long should a Git branch live?
As short as practical. DORA research associates short-lived branches, merged within about a day, with higher delivery performance.
Related Terms
Related Pages
Move from definition to product context with the most relevant Oobeya pages for this term.