Commit

Version Controlbeginner

// Definition

A saved snapshot of changes in a Git repo, with a message describing what changed and a unique hash identifying it. Commits are the atomic unit of history — each one is a revertible, reviewable point you can return to. Good commits are small and focused; the message explains why, not just what.

// Why it matters

Commits are the unit QA reads when bisecting a regression ("which commit broke this test?") and the unit CI runs against. A clean commit history makes git bisect find a breaking change in minutes; a messy one (giant commits, vague messages) makes root-causing a failure far harder.

// How to test

git add tests/login.cy.ts
git commit -m "test: cover login lockout after 5 failed attempts"
# one logical change per commit → bisectable, revertable, reviewable
git bisect start          # later: find which commit broke a test

// Common mistakes

  • Giant commits bundling unrelated changes (un-bisectable, un-revertable)
  • Vague messages ("fix stuff") that explain nothing six months on
  • Committing secrets/credentials (they persist in history even if deleted later)

// Related terms