Unit 08 · lesson

Small Commits and Useful Messages

A commit is not a save button with a timestamp.

A useful commit says:

Here is one coherent change to the project.

Weak history

update
stuff
fix
more stuff
final
final2

The repository technically has commits.

The history explains almost nothing.

Better history

Add project collection layout
Move navigation links into data file
Fix baseurl-safe project links
Add keyboard focus treatment
Document production build command

These messages describe outcomes.

Commit scope

If one commit:

  • rewrites navigation;
  • adds a plugin;
  • changes every color;
  • moves project data;
  • fixes an unrelated typo;

then reviewing or reverting one decision becomes harder.

Guided split

Take two pending changes that solve different problems.

Use Git status/diff to separate them into two commits.

If needed, stage files/patches according to your Git workflow rather than bundling everything together.

Message test

A good message should help future-you understand the repository without opening every diff.

Ask:

If this commit caused a regression, would the message help me decide whether to inspect it?

Portfolio action

Create at least three coherent commits across this Unit.

Do not manufacture empty changes just to increase the count.

Checkpoint

Pick your weakest existing commit message and rewrite what it should have said, based on the actual diff.