>_ IzzyLab

Hands-on task

This task is step 2 of the course “Shipping a release”

A changelog list from git log

easy~3 min

Release 2.4.0 needs a changelog for the release note. From the repository /srv/billing, export the subjects of all commits to /root/CHANGES.txt as a bulleted list: each line is - (a hyphen and a space) followed by the commit message, without hashes, authors or dates, newest first.

What you'll practise:
  • git log
  • --pretty=format
  • placeholders
  • changelog
  • redirection

Topic breakdown

A release changelog is easy to build straight from the history: if commit messages are meaningful, their subjects are ready-made list items. git log can print each commit using a custom template via --pretty=format:'…': in the template, plain text (for example, a list marker) is mixed with % placeholders, each of which inserts its own part of the commit — hash, author, date, subject. The default order is newest to oldest, as is customary for a changelog. The result is redirected to a file, and a repository outside the current directory is specified with git -C.

What's checked

  1. one line per commit
  2. newest commit on top, the first one at the bottom
  3. every line is a list item without hashes

What it looks like