Home > Net >  What are the built-in git log formats?
What are the built-in git log formats?

Time:06-25

In reading about git log, I have discovered it is possible to choose from an array of built-in formats (e.g. --pretty=reference) or create your own. Custom "PRETTY FORMATS" are quite capable, with many placeholders to choose from and the option to add colors too.

However, I have no need to create a format from scratch. I would rather tweak the presets that ship with git. Are the format strings for these presets available so I can pass them to

git log --pretty=format:<format-string>

and change them as desired?

CodePudding user response:

You can consult all available preset options at https://git-scm.com/docs/pretty-formats

Note that you can build your own using format:<format-string>, all available options for the format string being also described in the man page above.

CodePudding user response:

You can see some of the preset format-string used by Git in builtin/shortlog.c#shortlog_add_commit(), for instance.

Example:

if (log->groups & SHORTLOG_GROUP_AUTHOR) {
        strbuf_reset(&ident);
        format_commit_message(commit,
                      log->email ? "%aN <           
  •  Tags:  
  • git
  • Related