Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Automate creation of documentation from Git history

A worked example

Complete the statement

Your team tags every release in a Git repository. The two most recent tags are v1.2.0 and v1.3.0. You want the changelog section for version 1.3.0 to be built automatically from the commits added after v1.2.0 up to and including v1.3.0. A team script, format-changelog.sh, formats the commit list before it is saved.

How should you complete the command?

git v1.2.0..v1.3.0 | ./format-changelog.sh > changelogs/1.3.0.md

  • Blank 1: log (correct answer)

    git log lists commits and their messages, which is the content a changelog is built from. diff outputs line changes to file content, not the commit list. blame annotates the lines of a single file. tag creates or lists tags rather than listing the commits between them.

Why

Native Git commands can generate changelog content automatically. Running git log over the range between the previous version tag and the new version tag gives one section per version. That output can then be passed to a helper script and written to a changelog file for that version.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free