Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Branch

Direct answer

A Git branch is a movable local reference to a commit that provides a named line of development; it is not a separate copy of repository history.

When to use this

Use it when configuring, checking or troubleshooting Branch in Git.

First 30 seconds

1. Branches isolate work.

2. Short-lived feature branches.

3. Protect main.

4. Delete merged branches.

5. Naming conventions.

Operational verification

main → feature branch → PR → main

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Git version-control automation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformGit version-control automation · Branch owns local named refs and tracking relationships. Remote synchronization is covered by Remote/Pull/Push; release identity is covered by Tag.
Scope / prerequisiteUse it when configuring, checking or troubleshooting Branch in Git.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

4 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

HEAD selection → local branch ref → commit graph → upstream config → remote-tracking ref → fetched remote ref

Healthy evidence: HEAD is on the intended branch, worktree state is deliberate, upstream is explicit and divergence is measured against freshly fetched remote refs.

Step 2 Failure modes and next checks Narrow the fault

Suspicious evidence: committing on wrong branch, stale remote-tracking refs, hidden carried changes, accidental detached HEAD or treating branch names as immutable.

Step 3 Common mistakes Narrow the fault
  • Long-lived branches drifting from main.
Step 4 Where it fails Narrow the fault

Where Branch usually goes wrong: ref identity, fast-forward/divergence, merge/rebase policy and remote tracking.

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Branch exists ≠ upstream configured; a local branch can have no tracking relationship.
  • Branch name ≠ fixed snapshot; it moves as commits are added or refs are reset.
  • Switching branch ≠ clean isolation; uncommitted changes may carry across when Git permits it.
  • Remote-tracking branch ≠ live remote ref; it reflects the last fetch state.
Key checks
  • git branch -a — branches
  • git switch -c feature/<name> — create branch
  • git branch --merged main — merged branches
ReferenceWhat it is1 section · depth on demand

Core model

Treat branch name, pointed-to commit, upstream relationship, remote-tracking ref and worktree attachment as distinct state. Branch creation, switching and publication are separate operations.

ReferenceImportant terms & boundaries2 sections · depth on demand

What this shows and what it does not

A branch pointing at a commit shows only the current local ref position, but it does not show the upstream exists, is current or contains the same history.

Remote synchronization is covered by Remote/Pull/Push; release identity is covered by Tag.

In depth

A Git branch is a lightweight pointer to a commit that moves forward as you commit. Branches let work happen in isolation — a feature, a fix, an experiment — before merging into the main line.

git switch -c feature/ntp-oslo
git branch -a
git push -u origin feature/ntp-oslo
git branch -d feature/ntp-oslo        # after merge
Branch modelDescription
Trunk-basedShort-lived branches merged into main quickly
GitHub flowBranch → PR → merge to main → deploy
Release branchesMaintain older versions

Short-lived branches cause fewer merge conflicts and keep automation code closer to what is deployed.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docGit version-control automation current

Authoritative/upstream documentation reviewed for bounded claims in Git > Branch. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://git-scm.com/docs · confidence 94%
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
git branchbranchesupstream branchremote tracking branch
Embedded reference data

Quick lookup tables

Branch Git boundary map

Fast local-state, history/ref, remote and downstream proof boundaries for Branch.

BoundaryHealthy evidenceSuspicious evidence
Local stateRepository, HEAD, worktree/index and commit IDs are explicitWrong repo/ref, hidden staged/untracked state or mutable-name ambiguity
History / refsAncestry and branch/tag movement match intentUnexpected rewrite, stale tracking ref or unclear merge base
Remote syncURL/refspec, auth and remote read-back match expected commitsLocal assumptions, rejection, stale fetch or unsafe force update
Downstream proofBuild/reconciliation/target is verified independentlyPush/tag/merge success treated as deployment success
Depth when you need it

Deep reference

Healthy vs suspicious evidence

Output interpretation

For Branch, rely on structured fields and stable IDs (ref identity, fast-forward/divergence, merge/rebase policy and remote tracking) rather than text formatted for display.

Confirmation

Confirm action

Continue?