A giant commit with the message “various changes” is a debt you pay later, usually at 2 a.m. hunting for what broke production.

One commit, one idea

The rule is simple: each commit should represent one complete logical change. If the message needs the word “and”, it’s probably two commits.

❌ fix login and refactor header and update deps
✅ fix: correct redirect after login
✅ refactor: extract header logic into a hook
✅ chore: update dependencies

Why it matters

  • Easier review: nobody reviews an 800-line diff well. A 40-line one, yes.
  • git bisect works: if every commit is atomic and leaves the code working, finding the one that introduced a bug takes minutes.
  • Surgical git revert: you can undo one change without dragging three others along.
  • Readable history: the log becomes the narrative of how the project grew.

The message counts too

Use the imperative and explain the why, not the what (the diff already says what changed):

fix: prevent double submit on the checkout form

The button wasn't disabled during the request, allowing
duplicate charges if the user double-clicked.

Small commits don’t slow you down. They save you the hours you’d otherwise lose debugging blind.