Reading the Real History
Eight real commits. Some are genuinely clear ("Add salt to taste note in soup recipe"); some are genuinely useless
("fixed stuff", "asdf", "Update") — the message tells you nothing about what actually changed.
What a Useless Message Actually Costs
The message says "asdf" — but the real diff shows exactly what changed: a "Serves: 24 cookies" line was added to
cookies.md. That information existed the whole time; it just was not in the one place (the message) where you would
normally look for it first.
Amending What You Still Can
git commit --amend -m "Add basic garden salad recipe"
The tip commit ("Update") can genuinely still be rewritten, since nothing else in history depends on its exact hash
yet. Older bad messages further back cannot be edited this easily — real history rewriting is a later topic
(interactive rebase, Certificate 3).
Writing One Properly, Going Forward
git commit -m "Add Belgian waffles recipe" -m "Rounds out the breakfast section alongside the existing recipes."
A real subject line (imperative mood: "Add", not "Added" or "Adding") plus a real body explaining why — exactly
the shape a genuinely useful commit message takes.
This lesson opens on a real, provided sample history — eight genuine commits already sitting in ~/recipes, written the way a lot of real projects actually look: some messages are clear and specific, others are genuinely useless ("fixed stuff", "asdf", "Update"). Nothing here is exaggerated for effect — this is what real, unreviewed commit history looks like.
The fix is not to go back and rewrite every bad message — real, shared history is not something you can just edit at will (that is a Certificate 3 topic, interactive rebase). What you genuinely can do: amend the most recent commit before anyone else has seen it, and — more importantly — write every commit from here on the way this lesson teaches, so future-you never has to play detective on your own work again.
Imperative mood
Writing a commit subject as a command ("Add", "Fix", "Remove") rather than as a description of what was done ("Added", "Fixed", "Adding"). This matches how git itself phrases its own generated messages (a real merge commit says "Merge branch...", not "Merged branch...") and reads naturally as "this commit will ___" when applied.
git commit --amend
Replaces the most recent commit with a new one — same parent, same position in history, but a genuinely different message (and optionally different staged content). Confirmed directly in this lab: it only ever touches the tip commit, never anything further back.
Subject vs. body
The subject (first line) is a short, real summary; the body (after a blank line) is where the why goes — context a diff alone can never provide. git commit -m <subject> -m <body> writes both in one real command.
Takeaways
- A vague commit message never loses the diff (git show always recovers it) — it loses the why, which a diff alone can never provide
- git commit --amend genuinely rewrites only the tip of history — older commits are untouched, confirmed directly
- Real history rewriting further back than the tip needs interactive rebase, a Certificate 3 topic — amend is not a substitute for it
- A good subject line is written in imperative mood ("Add", not "Added") — the same convention git's own generated messages use
- git commit -m <subject> -m <body> writes both the summary and the reasoning in one real command