Git
Git log
Command line
Version control
Software development

The shortest possible output from Git log, containing author and date

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

If you only need author and date from git log, the default output is far too noisy. Git's pretty-format placeholders let you reduce each commit to exactly the fields you care about, which makes the history easier to scan and easier to pass into scripts.

The Minimal Command

If the requirement is strictly author and date, the shortest useful command is:

bash
git log --format='%an %ad' --date=short

Example output:

text
Jane Smith 2026-03-11
John Doe 2026-03-10

%an means author name. %ad means author date, and --date=short turns the date into the compact YYYY-MM-DD form.

Why --format Matters

Without --format, Git prints commit hashes, commit messages, and extra metadata. The --format option tells Git to build each line from placeholders instead.

Some useful placeholders are:

  • '%an for author name'
  • '%ae for author email'
  • '%ad for author date, respecting --date'
  • '%aI for strict ISO author date'
  • '%h for abbreviated hash'
  • '%s for the subject line'

That means you can keep the output minimal while still adapting it to different workflows.

Useful Variations

If you want the output to stay short but remain more script-friendly, use ISO timestamps.

bash
git log --format='%an %aI'

Example output:

text
Jane Smith 2026-03-11T09:15:22-04:00
John Doe 2026-03-10T17:40:03-04:00

If you need just one line per commit with a little extra identity, add the short hash.

bash
git log --format='%h %an %ad' --date=short

If you want relative dates for quick human scanning, use %ar instead of %ad.

bash
git log --format='%an %ar'

Keep It Stable for Scripts

For shell scripts and automation, use a delimiter that cannot appear easily in names, such as a tab.

bash
git log --format='%an%x09%aI'

%x09 inserts a tab character. That makes parsing more reliable than splitting on spaces, especially when author names contain multiple words.

A quick shell example:

bash
git log --format='%an%x09%aI' | while IFS=$'\t' read -r author date; do
  printf 'author=%s date=%s\n' "$author" "$date"
done

Save It as an Alias

If this is a frequent query, define an alias.

bash
git config --global alias.authordates "log --format='%an %ad' --date=short"

Then run:

bash
git authordates

That avoids retyping format placeholders and keeps your team command examples consistent.

Author Date Versus Committer Date

Git stores both author and committer metadata. The author is the person who originally wrote the change. The committer is the person who last applied it to the repository history.

If a commit is rebased or cherry-picked, those values can differ. %an and %ad refer to author data. If you want committer data, use %cn and %cd instead.

Common Pitfalls

A common mistake is using %ad without --date=short or another explicit date style. The output will still work, but it will be much longer than expected.

Another mistake is assuming author date and committer date are interchangeable. They are often the same, but not always.

For scripts, avoid splitting plain-space output if you can. Multi-word author names make naive parsing fragile.

It is also easy to forget that aliases capture quoting rules literally. Test the alias once after creating it so shells and Git parse the placeholders the way you expect.

Summary

  • The shortest author-plus-date log is git log --format='%an %ad' --date=short.
  • Use %aI when you need a precise machine-friendly timestamp.
  • Add %h only if you also need commit identity.
  • Prefer tabs or other explicit delimiters for scripting.
  • Distinguish author fields from committer fields when history rewriting matters.

Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Basis Lab
No course covers this one yet

Basis Lab writes one for you from a sentence about what you want to be able to do, then teaches it and checks you understood. Your first course is free.

Build my course
Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions