Unit 08 · lesson

Read a Diff

A diff is one of the most useful technical reading tools in this course.

It answers:

What changed between two source states?

Working-tree diff

git diff

shows unstaged changes relative to the current indexed/committed state.

Staged diff

git diff --staged

shows what you are preparing to commit.

Commit diff

Use Git commands appropriate to inspect a commit, for example:

git show --stat <commit>
git show <commit>

Read meaning, not colors

A diff may show removed/added lines.

Ask:

  • Which responsibility changed?
  • Did source, configuration, content, or CSS change?
  • What generated output should change because of it?
  • What should remain invariant?
  • Does the commit contain unrelated work?

Jekyll-specific diff reasoning

If _config.yml changes, blast radius may be site-wide.

If one _projects/foo.md changes, expected output may be local to one project and generated indexes.

If _layouts/default.html changes, many pages may rebuild differently.

The source path predicts scope.

Lab

Read one of your own recent diffs before running Jekyll.

Write a prediction of affected output.

Build.

Compare prediction to observed changed pages/files.

Checkpoint

Submit one diff with annotations connecting changed source lines to expected generated behavior.