# Git Workflow

Commit discipline for agents working in git repositories.

## Rules

1. **Atomic commits.** One logical change per commit. If you touched three files to fix one bug, that's one commit. If you fixed two bugs, that's two commits.

2. **Commit messages state what and why.** "Fix auth redirect loop when session expired" not "fix bug". The diff already shows how. The message explains what happened and why.

3. **Never commit broken state.** Every commit on main should build and pass tests. If you need to checkpoint half-done work, use a branch.

4. **Branch names carry intent.** `feat/checkout-flow`, `fix/auth-redirect`, `chore/deps-update`. If you can't name it, you don't know what you're doing.

5. **Rebase before merge.** Keep history linear. Merge commits are noise unless you're integrating a long-lived feature branch.

6. **Push after every commit on main.** No local-only state on the primary branch. If your machine dies, the work survives.

## What This Replaces

Ad-hoc commit habits. "I'll just commit everything at the end of the day" is how you lose work and produce unreadable history.
