Formatting

    Foreword 🔗

    Source: https://git-scm.com/docs/pretty-formats#Documentation/pretty-formats.txt-emnem

    Used to control output for commands like log.

    Example 🔗

    For example to see the last committed date of a file use the following. The -1 means return only the most recent.
    NB: Your current directory should be within the repo. Command originally found on SO but link to formatting options was broken so hence this page.

    git log -1 --format=%cd filename.txt
    

    Excerpt from placeholder options 🔗

    placeholderDescription
    %nnewline
    %%a raw %
    %Hcommit hash
    %habbreviated commit hash
    %anauthor name
    %cncommitter name
    %ssubject
    %bbody
    %cdcommitter date (format respects –date= option)
    %cDcommitter date, RFC2822 style
    %crcommitter date, relative
    %ctcommitter date, UNIX timestamp
    %cicommitter date, ISO 8601-like format
    %cIcommitter date, strict ISO 8601 format
    %cscommitter date, short format (YYYY-MM-DD)
    %chcommitter date, human style (like the –date=human option of git-rev-list[1])