C.W.K.
Stream
Lesson 04 of 04 · published

Commit Early, Commit Often, Commit Intentionally

~18 min · zen, habit

Level 0Untracked Rookie
0 XP0/47 lessons0/14 achievements
0/100 XP to next level100 XP to go0% complete

Commit early, often, and intentionally

The Zen lesson. Most Git advice is mechanical: which command, which flag, which workflow. The hardest skill to teach is the rhythm — when to commit, how often, with what intent. The team that commits intentionally has a different relationship with their code than the team that commits "when something is done." Almost every Git pain in this quest dissolves when this rhythm is in place.

Commit early. A commit is not a milestone; it is a checkpoint. The moment you have a coherent unit of work that compiles and at least roughly works, commit. Do not wait for "done" — done is a high bar that rarely arrives in one session. Frequent small commits give you reflog history at fine resolution, the option to bisect through your own work, the ability to abandon an experiment without losing the parts that worked.

Commit often. A working session should produce many commits, not one. Each commit captures a thought: "this function now handles empty input," "this typo was fixed," "this refactor extracts the helper." Later you may squash them with interactive rebase before pushing, or leave them, depending on policy. The point of frequent commits is the safety net during the session, not the published shape of history.

Commit intentionally. Each commit should answer one question: what concept did I move forward? If the answer requires "and" or "also," it is two commits. If you cannot articulate the answer in 50 characters, the work is not yet a coherent unit — keep editing. The commit message is a forced reflection: by the time you write a sharp message, you have understood what changed. The act of writing the message tells you whether the change was clean.

The compounding payoff over a year. Engineers who commit early-often-intentionally have legible reflog histories, can bisect through their own past work in seconds, can abandon dead-end branches without losing the salvageable parts, and read a year-old git log and remember what they were thinking. Engineers who commit "when done" have one giant commit per feature, no recovery granularity, and read their own old code as if a stranger wrote it. The skills compound; so does the absence.

Code

A real working session, in commits·text
# Two-hour session on a feature, condensed:
abc1234 feat(search): hold empty result state explicitly
def5678 test(search): cover empty array via /api/search
9876543 fix(search): handle missing query param fallback
fedcba0 refactor(search): extract result-formatter helper
1122334 docs(api): document /search empty-result shape
aabbccd chore(search): tidy imports after refactor

# Pushed as-is, OR squashed via rebase -i before review.
# Either way, the SESSION had six clean checkpoints.
# Reflog has fine resolution. Bisect can isolate any of them.
Helpful aliases for the rhythm·bash
# Quick status:
git config --global alias.s 'status -sb'

# Pretty graph log:
git config --global alias.lg 'log --oneline --graph --decorate --all'

# Add interactively, then commit (the daily habit):
git config --global alias.cap '!git add -p && git commit'

# Quick amend without changing the message:
git config --global alias.fixed 'commit --amend --no-edit'

# Show what is in the most recent commit:
git config --global alias.last 'log -1 -p'

# Now your routine:
git s          # status
git add -p
git commit -m "fix(...): ..."
git lg         # admire the graph
git fixed      # if you forgot something
git last       # confirm what landed

External links

Exercise

On your next real coding session — at least an hour of work — deliberately commit at every coherent checkpoint, with real messages. Aim for at least 5 commits in an hour-long session. After the session, run git log --oneline on your branch and read the result. Note in writing whether the rhythm felt unnatural, where you almost slipped back into one big commit, and what the resulting log would mean to you in three months.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.