Skip to content
Justice Tech School

Log Formats

git log has many formats: --oneline, --format with placeholders like %an (author) and %s (subject), and -n to limit the count.

Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
echo two >> a.txt && git commit -qam 'Second'
git log --format='%an: %s'
git log -n 1 --format=%s
git rev-list --count HEAD

Result

Ada: Second
Ada: first
Second
2

Exercise

Limit to one commit.

git log - 1

Quiz Test

Which placeholder is the subject?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.