Claude Code in a Minute · intermediate

Claude Code in a Minute: Git workflow

Use a branch-per-task Git workflow with Claude Code so agent commits stay reviewable and reversible.

Last verified: 2026-09-06

In one sentence

A Claude Code Git workflow isolates each task on a branch, keeps commits small, and lands changes through review.

Why it matters

Agent speed without Git discipline produces unreviewable history. Branches and pull requests turn machine output into team-safe delivery.

How it works

Default loop:

  1. create or switch to a task branch;
  2. give Claude Code a scoped outcome and verification gate;
  3. review the diff before pushing;
  4. open a PR;
  5. let CI re-run the same gates.

Prefer conventional, intent-revealing commit messages. Do not let the agent rewrite shared history on protected branches.

When running multiple Claude Code sessions, use separate worktrees so checkouts do not collide.

Example

git switch -c fix/form-validation
# run Claude Code on the task
git status
git diff
# push and open PR after review

Agentic coding use

Git is the integration bus for agentic work. Claude Code is the worker; the branch/PR is the control surface humans still own.

Watch out

“Commit everything that changed” after a vague prompt often mixes refactors with the fix. Reset scope in the prompt, or split commits before you push.

Sources