Reputation: 268
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?
Upvotes: 1
Views: 106
Reputation: 1329082
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 <%aE>" : "%aN",
&ident, &ctx);
if (!HAS_MULTI_BITS(log->groups) ||
strset_add(&dups, ident.buf))
insert_one_record(log, ident.buf, oneline_str);
}
if (log->groups & SHORTLOG_GROUP_COMMITTER) {
strbuf_reset(&ident);
format_commit_message(commit,
log->email ? "%cN <%cE>" : "%cN",
&ident, &ctx);
But that illustrates that those preset are not available in a neat list somewhere, rather used directly in the Git source code.
Upvotes: 2
Reputation: 185
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.
Upvotes: 1