git log --pretty=format:<format_string>

View the commit history in a custom format

This command retrieves the commit history of the repository and displays it according to a custom format specified by the --pretty flag.

By using different combinations of these and other placeholders, you can customize the output to your liking.

The format is defined using format placeholders like:

  • %h for the commit hash
  • %an for the author name
  • %ar for the author date relative to now
  • %s for the commit subject
  • %b for the commit message body
  • %ae for the author's email
  • %ad for the commit date

There are tens of other placeholders to introduce new lines, colors and many other bits of information.

Welcome to GitExamples!

Sign in to enable bookmarking, reminders, progress-tracking and more...