Git in a Minute · beginner

Git in a Minute: Commits

A commit snapshots a set of changes with a message—your unit of history for review and rollback.

Last verified: 2026-09-06

In one sentence

A commit records a snapshot of selected changes plus a message explaining the intent.

Why it matters

Agents can generate large diffs. Commits carve that work into reviewable steps. Bad commit habits hide mistakes and make git bisect useless.

How it works

Stage related changes, then commit with a message that states why. Prefer several small commits over one mixed bag when the changes are logically separable.

For agent workflows, require the agent to summarize what changed before committing—or commit yourself after reviewing git diff.

Example

git add app/learn/page.tsx
git commit -m "$(cat <<'EOF'
Add learning paths section to the learn index.

EOF
)"

Agentic coding use

Commits are the audit trail for machine labor. Treat agent commits as first-class engineering artifacts, not disposable noise.

Watch out

Generated messages like “Update files” waste history. Reject them. Also avoid committing secrets the agent may have created or copied.

Sources