git-log-compact

A compact alternative to git log --oneline that includes dates, times and author and/or committer initials in a space efficient output format. See all the example images together.

Overview

The git-log-compact script is intended to fill the gap between the --oneline log output format and the --pretty=short/--pretty=medium output formats. It is not strictly a one line per commit output format (but almost) and while it only shows the title of each commit (like the --pretty=short format) it does include author and date information (like the --pretty=medium format) except that timestamps are shown very compactly and author/committer names are shown as initials.

This allows one to get a complete view of repository activity in a very compact output format that can show many commits per screen full and is fully compatible with the --graph option.

The --notes, --pretty and --format options are not allowed but any other git log options should work fine (especially --graph).

In both --graph and non --graph modes:

When --graph mode is enabled, the graph output is enhanced as follows:

Installation

Clone the repository from https://github.com/mackyle/git-log-compact.git or just grab the git-log-compact file directly (click the “Raw” link on that page).

Put the git-log-compact executable file in one of the directories included in the PATH environment variable.

Optionally set a global alias to save typing such as lc like so:

git config --global alias.lc log-compact

Optionally set global default options such as --two-initials and --abbrev=8 like so:

git config --global log-compact.defaults "--two-initials --abbrev=8"

Dates & Times

Dates and times are shown in the local timezone. Set the TZ variable before running git log-compact (e.g. TZ=UTC git log-compact to show dates and times in UTC) or use the --time-zone= option (e.g. git log-compact --time-zone=UTC) to change that.

Dates are shown on a date line all by themselves like so:

=== 2015-11-13 ===

The date line indicates that the times on all the following lines (regardless of whether or not --reverse is being used) up until the next date line take place on the indicated date. For example this output:

=== 2015-09-28 ===
be08dee9 13:18 jc (tag: v2.6.0) Git 2.6
=== 2015-09-21 ===
8d530c4d 13:26 jc (tag: v2.6.0-rc3) Git 2.6-rc3
904f6e7c 10:51 bn send-email: fix uninitialized var warning for $smtp_auth
=== 2015-09-20 ===
18a21c19 09:49 ps l10n: de.po: better language for one string
2e0f3663 09:49 rt l10n: de.po: translate 2 messages
5fc31c1f 09:44 tq l10n: Update and review Vietnamese translation

shows one commit on 2015-09-28, two commits on 2015-09-21 and three commits on 2015-09-20.

Note that a date line may appear more than once for the same date (this is especially common when using --graph with its default --topo-order).

The purpose of a date line is to indicate what date has been elided from the following lines, nothing more.

Examples

See all the example images together.

For example, running git log-compact --decorate --graph -n 17 v2.6.1 on the Git repository produces this output (which will be colorized on the terminal if color is enabled):

The output will be colorized according to the same settings used to enable/ disable color for git log output.

Additionally, the color of the three new items (dates, times and initials) can be controlled with the color.log-compact.date, color.log-compact.time and color.log-compact.initials config options.

Running git log-compact --graph --max-parents=0 on the Git repository gives:

Notice the _ on either side of the hash identifying those commits as root commits. The _ will only appear on the left side of the hash if the selected output format would have normally included a space there. In --graph mode, all the spaces between the commit mark (e.g. *) and the hash are turned into _.

Running git log-compact --decorate --graph --no-merges -n 13 v2.6.1 on the Git repository results in this output:

Notice how four linear breaks (..........) were automatically inserted to avoid parent child relationship confusion.

In non --graph mode, linear breaks are NOT automatically inserted. They must be requested with the usual --show-linear-break option.

See more example images.

Options

In addition to allowing all the normal git log options except for --notes, --format and --pretty (--oneline is allowed and silently ignored), the following additional options may be utilized:

In addition to the above options, color output is controlled as normal for git log with the addition of color.log-compact.date, color.log-compact.time and color.log-compact.initials config options to alter the default colors for dates, times and initials respectively.

Furthermore, default options may be set in the log-compact.defaults config value and they will be treated as though they appeared at the very beginning of the git log-compact command line option list (e.g. git config log-compact.defaults "--abbrev=8 --seconds").