Git in a Minute · beginner
Git in a Minute: Branches
A branch is a movable pointer to a commit—your named line of history for a change.
Last verified: 2026-09-06
In one sentence
A branch names a line of commits so work can progress without rewriting everyone else’s history.
Why it matters
Agents produce commits quickly. If they commit on main, recovery and review get harder. Branches give you a review boundary and a rollback unit.
How it works
Creating a branch points a new name at the current commit. New commits advance that pointer. Other branches stay put until you merge, rebase, or cherry-pick.
For agent work, prefer short-lived branches named after the task, not the model. Humans reviewing the PR should understand the intent from the branch and PR title alone.
Example
git switch -c fix/contact-validation
# agent works and commits here
git push -u origin HEAD
Agentic coding use
One task → one branch → one pull request is the default control loop for agentic delivery. It keeps machine speed compatible with human review.
Watch out
Long-lived agent branches diverge and become painful to merge. Prefer small tasks and frequent integration over a week-long “agent sandbox” branch.