>_ IzzyLab

Hands-on task

This task is step 10 of the course “Everyday Git”

Build a Release Note from History

easy~3 min

You need a changelog note. From the repository /root/project, export the messages of all commits (one per line, without hashes or dates) into the file /root/changelog.txt, with the most recent one on top.

What you'll practise:
  • git log
  • output formatting
  • commit placeholders
  • output redirection
  • changelog

Topic breakdown

The git log command can not only print history in the default multi-line form but also format each commit by a given template via the --pretty=format:'...' option. Inside the template live placeholders (%-sequences), each of which substitutes its own part of the commit: hash, author, date, subject, body. To build a changelog you need to keep only the subject of each commit — that gives one line per commit. The order of git log is already newest to oldest, and the output is redirected into a file with the > operator.

What's checked

  1. changelog has the messages of all commits
  2. freshest commit on top
  3. changelog has only messages, no hashes

What it looks like