Back to Cheatsheets

Git log format string

Git2017-10-18

Log format

{: .-three-column}

Pretty format

{: .-prime}

git log --pretty="format:%H"

See the next tables on format variables.

Hash

Commit

VariableDescription
%Hcommit hash
%h(abbrev) commit hash

Tree

VariableDescription
%Ttree hash
%t(abbrev) tree hash

Parent

VariableDescription
%Pparent hash
%p(abbrev) parent hash

Commit

VariableDescription
%scommit subject
%fcommit subject, filename style
%bcommit body
------
%dref names
%eencoding

Author and committer

Author

Name

VariableDescription
%anauthor
%aNauthor, respecting mailmap

Email

VariableDescription
%aeauthor email
%aEauthor email, respecting mailmap

Date

VariableDescription
%aDauthor date (rfc2882)
%arauthor date (relative)
%atauthor date (unix timestamp)
%aiauthor date (iso8601)

Committer

Name

VariableDescription
%cncommitter name
%cNcommitter name, respecting mailmap

Email

VariableDescription
%cecommitter email
%cEcommitter email, respecting mailmap

Date

VariableDescription
%cDcommitter date (rfc2822)
%crcommitter date (relative)
%ctcommitter date (unix timestamp)
%cicommitter date (iso8601)

Also see