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:
- Root commits are identified by
_
on either side of the hash
When --graph
mode is enabled, the graph output is enhanced as follows:
- Breaks are inserted when necessary to avoid parent/child ambiguity
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:
--seconds
include seconds in the time (i.e. HH:MM:SS instead of just HH:MM)
--minutes
include minutes but not seconds in the time (i.e. HH:MM not HH:MM:SS)
This is the default
--no-times
omit the time field entirely
--two-initials
only show at most two initials instead of the usual three
This is the default if --initials=author,committer
or
--initials=committer,author
is used.
--three-initials
show at most three initials
This is the default unless --initials=author,committer
or
--initials=committer,author
is used.
--no-initials
omit the initials field entirely
--commit-message
when using --walk-reflogs
show commit message not reflog message
--author-date
force use of author dates and times
The default is to use committer dates and times unless
--author-date-order
is in effect. This option forces author
dates and times to always be used and overrides --committer-date
.
--committer-date
force use of committer dates and times
The default is to use committer dates and times if --date-order
or
--topo-order
is in effect or --author-date-order
is NOT in effect.
This option forces committer dates and times to always be used and
overrides a previous --author-date
option.
--initials=author
show author initials
This is the default behavior
--initials=committer
show committer initials instead of author initials
--initials=author,committer
show author and commiter initials separated by a /
This changes the initials width default from three to two.
--initials=committer,author
show commiter and author initials separated by a /
This changes the initials width default from three to two.
--time-zone=zone
set the TZ environment variable to zone
This is an alterative to setting TZ before running git log-compact
and will affect the time zone dates and times are displayed in.
--weekday
show the weekday with the date
--no-weekday
do not show the weekday with the date
This is the default behavior
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"
).