>_ IzzyLab

Hands-on task

This task is step 5 of the course “Git: rewriting and rescuing history”

Export an author's commits to a file

easy~3 min

In /root/repo there are commits by several authors mixed together: alice, bob, carol.

Build a file /root/out.txt that lists, one per line, the subject lines of all commits whose author is alice (and only those; who made the commit itself doesn't matter), in order from newest to oldest (as git log outputs by default). No hashes, dates, or extra fields — only the subject lines.

What you'll practise:
  • git log
  • --author
  • history filtering
  • --pretty
  • output format

Topic breakdown

git log is not only for browsing history but also a selection tool: it can be filtered by author, date, path, and many other criteria, and the format of each line can be set arbitrarily. The author filter accepts a substring of the name or email, and the format placeholders (--pretty/--format) let you output only the field you need, such as the message subject. By default commits go from newest to oldest, so no additional sorting is required — just redirect the output to a file.

What's checked

  1. the file has the subjects of all alice's commits
  2. no extra lines
  3. newest to oldest, no repeats

What it looks like