libra log
Command reference for `libra log`
Show commit history.
Aliases: hist, history
Synopsis
libra log [OPTIONS] [<revision-range>] [[--] <path>...]
Description
libra log displays the commit history starting from the current HEAD. It supports multiple
output formats including oneline, custom pretty-print, graph visualization, and structured
JSON. Commits can be filtered by author, date range, and file paths. Diff output (--patch,
--stat, --shortstat, --name-only, --name-status) can be limited to specific paths.
Human mode preserves the current --oneline, --graph, --pretty, --stat, --patch, and
related output styles. --quiet suppresses human output but still validates the requested
history range.
When stdout is piped and the downstream command exits early, libra log exits quietly without
printing panic/backtrace or Broken pipe diagnostics.
In a shallow clone, commits listed in .libra/shallow are treated as roots: log
does not follow their parents. A corrupt .libra/shallow file fails closed
(LBR-REPO-002). Removing the file when parents were never fetched also fails
closed and hints to run libra fsck. Recorded parent ids (%P, --parents)
still come from the stored commit object.
Options
-n, --number <N>
Limit the number of commits shown.
libra log -n 5
libra log --number 10
--oneline
Shorthand for --pretty=oneline --abbrev-commit. Shows each commit on a single line with
an abbreviated hash and subject.
libra log --oneline
--abbrev-commit
Show abbreviated commit hashes instead of full 40-character hashes.
libra log --abbrev-commit
--abbrev <LENGTH>
Set the length of abbreviated commit hashes.
libra log --abbrev 8
Terminal output
Non-TTY output (pipes, files) never contains carriage returns or erase-line
(ESC[K) sequences. Under a real terminal the only difference is the terminal
driver's \n → \r\n translation, so libra log can be byte-compared against
the piped output after dropping the CRs. --color=always keeps the SGR styling
and still adds no erase-line sequences.
--output=<file>
--output=<file> writes the human-readable log to <file> and leaves stdout
empty. An existing regular file is overwritten in place — same inode, same
permissions, truncated through the verified descriptor, like Git's
xfopen(path, "w") — while a directory target fails with LBR-IO-002. Any path
whose final target lives inside the repository metadata directory .libra/ is
refused as well, including through a symbolic or hard link that reaches a
repository file; this is a Libra-only guard, since Git has no such restriction. Symbolic links are followed to their final target,
so a dangling link creates the file it points at, matching Git. With the global
--json flag the JSON envelope itself is written to the file instead, leaving
stdout empty.
libra log --oneline --output=log.txt
Empty --format= / --pretty=
An empty format prints nothing per commit, matching Git: --format=,
--pretty= and --format=tformat: emit no bytes, while --format=format: emits
only the newline separators between commits. Diff output (--stat, -p) still
prints, without the commit header.
libra log --format=
libra log --format=format:
libra log --format= --stat
--cc
--cc prints a dense combined diff for merge commits: only the paths that differ
from every parent are listed, each with diff --cc <path>, an index <p1>,<p2>..<merge> line and one @@@ -… -… +… @@@ hunk whose body carries a column
per parent. Non-merge commits keep the ordinary patch, so log --cc -1 <commit>
equals log -p -1 <commit> there. The option implies -p.
libra log --cc -1 <merge>
--find-object=<object>
Keep only the commits whose diff against their first parent touches <object>:
either side of a changed file pair (so a rename with the same blob still matches)
or a tree that appears on only one side. The option is repeatable and the values
form a union. An object id that cannot be parsed fails with LBR-CLI-003.
libra log --find-object=<blob> --oneline
libra log --find-object=<blob> --find-object=<tree> --format=%H
-R
-R (long spelling --reverse-diff) swaps the two inputs of every commit diff:
the labels become diff --git b/<path> a/<path>, the index hashes trade places and
the hunk shows the reverse edit, matching git log -R. It does not reorder the
commits — use --reverse for that.
libra log -R -p -1
--after / --before
--after=<date> is a visible alias of --since and --before=<date> of --until;
both spellings parse and fail identically (an unparseable date stays LBR-CLI-002,
exit 129).
libra log --after=2026-01-15 --oneline
libra log --before=2026-02-15 --oneline
--no-walk[=<mode>]
With --no-walk log shows only the commits named on the command line and does not
walk their ancestry. The bare flag (=--no-walk=sorted) orders them by commit time,
newest first; --no-walk=unsorted keeps the command-line order. Any other mode is
rejected with LBR-CLI-002.
libra log --no-walk --format=%H <commit-a> <commit-b>
libra log --no-walk=unsorted --oneline <commit-a> <commit-b>
--tags[=<pattern>]
--tags pretends every ref under refs/tags/ is listed on the command line: without
an explicit revision it replaces the implicit HEAD start, and the pattern (Git
wildmatch) restricts the tags taken. Combine it with --no-walk to list exactly the
tagged commits.
libra log --tags --oneline
libra log --tags='v*' --no-walk --format=%H
--no-abbrev
--no-abbrev shows full object names in human-readable output, including
--oneline, %h, %p, --parents, and in-range --children IDs. It is
independent of --abbrev-commit and --oneline. When combined with
--abbrev=<N>, the last option wins; repeated --no-abbrev options are
accepted. JSON short_hash remains seven characters.
libra log --no-abbrev --oneline
libra log --no-abbrev --abbrev=10 --oneline
Passing a value directly to --no-abbrev is rejected with LBR-CLI-002
(exit code 129).
--no-abbrev-commit
Show full commit hashes. Overrides --abbrev-commit.
libra log --no-abbrev-commit
--pretty=<format> / --format=<format>
Choose the commit display format. Accepts the named presets and the
format:/tformat: custom-template prefixes (and a bare %-placeholder
template). --format is Git's alias for --pretty.
| Preset | Output |
|---|---|
oneline |
<hash> <subject> on one line |
medium (default) |
commit + Author + Date + indented message |
short |
commit + Author + indented subject (no date, no body) |
full |
commit + Author + Commit + indented message (no dates) |
fuller |
commit + Author/AuthorDate + Commit/CommitDate + message |
reference |
one-line <abbrev> (<subject>, <short-date>) |
raw |
the commit object's tree/parent/author/committer headers + indented message |
The presets inherit libra log's existing conventions (timestamps render in
UTC +0000; --pretty abbreviates the hash; the stored message's
subject/body blank line is collapsed), so they match Git's preset structure
rather than being byte-identical. libra show --pretty=<preset> uses the same
formats.
Custom templates support %H / %h (full / abbreviated commit hash), %P /
%p (full / abbreviated parent hashes), %s / %f (subject / sanitized
subject), %b / %B (body / raw subject+body), %n, ASCII/control %xNN, %%, %an / %ae /
%ad / %as / %ai / %ah / %aI / %at (author), %cn / %ce / %cd / %cs / %ci / %ch / %cI / %ct
(committer), %d / %D (decorations), %m, and common color placeholders
such as %Cred, %C(red), %C(always,red), and %Creset. Unknown
placeholders stay literal, matching Git's pretty-format behavior.
Color reset follows Git's color policy: %C(always,...) can force an ANSI
escape even when ordinary colors are disabled, while %Creset resets only when
color output is enabled; use %C(always,reset) when a forced-color template
also needs a forced reset.
libra log --pretty=short
libra log --pretty=fuller
libra log --pretty=reference
When no explicit --oneline, --pretty, or --format is present,
format.pretty supplies the default for both libra log and libra show.
The supported config values are the presets above or a non-empty custom
template using format:, tformat:, or a % placeholder. Empty values and
unknown bare preset names fail before output with LBR-CLI-002; an explicit
CLI format bypasses the matching config key.
Default layout
The default (medium) and the short/full/fuller/raw presets print one
blank line between commit records and none after the last one. The Date: line
uses Git's default form with an unpadded day of month
(Fri Jan 2 00:00:00 2026 +0000). oneline, reference, and custom
--format/--pretty records are separated by a single newline and print no
blank line. --oneline, --pretty, and --format are last-one-wins rather
than mutually exclusive, and show keeps the blank line between its header and
the indented message.
--date=<format>
Select the human-readable author/committer date mode. Supported modes are
default, short, iso/iso8601, iso-strict/iso8601-strict, human,
rfc/rfc2822, unix, raw, and format:<strftime> (the spec passes through
verbatim, case-sensitively). log.date supplies the default for human log and
show output; an explicit --date wins. Valid Git modes that this renderer does
not yet implement (relative, human, local, and auto:*) are rejected when
configured instead of being silently ignored. Dates in structured JSON keep
their schema-defined RFC3339 representation.
libra log --date=iso-strict
libra log --date='format:%Y-%m-%d'
libra log --pretty='format:%ad %s' --date=unix
-p, --patch
Show the diff (patch) for each commit. Can be combined with path arguments to limit the diff to specific files.
libra log -p
libra log -p -- src/main.rs
-s, --no-patch
Suppress diff output. This option can be repeated; each occurrence clears the diff output formats given before it
(-p/--patch, --stat, --shortstat,
--patch-with-stat, --name-only, and --name-status). Formats given after the
last -s/--no-patch remain effective. An active --name-only or
--name-status conflicts with active -s/--no-patch; the two name options
also conflict when both remain active after applying the option order. A later
diff format such as --stat clears -s, so name output can follow it. These
conflicts fail with LBR-CLI-002 (exit code 129). A later -s clears earlier
name options, so a cleared option does not conflict.
libra log -s -1
libra log -p -s --stat
libra log -s --name-only # error
libra log -s --stat --name-only # accepted; shows changed paths
libra log --name-only --name-status # error
libra log -s --name-only --no-patch # accepted; --name-only is cleared
--name-only
Show only the names of changed files for each commit. It cannot remain active
while -s/--no-patch is active or together with --name-status.
libra log --name-only
--name-status
Show names and status (added/modified/deleted) of changed files for each commit.
It cannot remain active while -s/--no-patch is active or together with
--name-only.
libra log --name-status
libra log --name-status -- src/
-z, --null
Use NUL separators for log records and changed-path output. With --name-only
or --name-status, the formatted commit text is terminated by NUL, the path
section is separated like Git, and each path/status field is NUL-terminated.
libra log -z --name-status --format=%s
--word-diff[=<mode>] / --word-diff-regex / --color-words
--word-diff renders the -p body as a word-level diff (plain by default, or
porcelain/color/none); --word-diff-regex=<re> chooses the word tokenizer and
--color-words[=<re>] is the coloured shorthand (it wins over --word-diff=plain).
All three reuse the shared libra diff word-diff renderer, so the body matches
libra diff with the same options byte for byte; an invalid mode or regex is
LBR-CLI-002.
libra log -p -1 --word-diff
libra log -p -1 --color=always --color-words
libra log -p -1 --word-diff-regex='[A-Za-z]+'
--color-moved[=<mode>] / --color-moved-ws=<modes>
--color-moved colours moved lines (removed side bold magenta, added side bold
cyan) in the -p output; --no-color-moved turns it off and the later flag wins.
--color-moved-ws selects the whitespace rules used while matching moved lines
(no, ignore-space-at-eol, ignore-space-change, ignore-all-space,
allow-indentation-change; comma-separated). Both reuse the shared libra diff
renderer, so the moved-line colouring matches libra diff for the same change.
Unknown mode values are LBR-CLI-002.
libra log -p -1 --color=always --color-moved
libra log -p -1 --color=always --color-moved --color-moved-ws=ignore-all-space
-U<n> / --unified=<n>
-U<n> sets how many lines of hunk context -p prints (-U0 shows only the
changed lines, -U1 one line on each side). The value is forwarded to the shared
diff engine; a non-numeric value is LBR-CLI-002/129.
libra log -p -1 -U1
libra log -p -1 --unified=0
--full-index
--full-index prints the complete object ids on every index header line
(index <old>..<new> 100644) — 40 hex characters in a SHA-1 repository, 64 in a
SHA-256 one. The flag is forwarded to the shared diff engine.
libra log -p -1 --full-index
--no-prefix / --src-prefix / --dst-prefix
--no-prefix drops the a//b/ labels (diff --git a.txt a.txt, --- a.txt,
+++ a.txt); --src-prefix=<p> and --dst-prefix=<p> replace them per side. The
flags are forwarded to the shared libra diff engine, so the bytes match
libra diff --src-prefix/--dst-prefix for the same commit.
libra log -p -1 --no-prefix
libra log -p -1 --src-prefix=x/ --dst-prefix=y/
-w / -b
-w (--ignore-all-space) ignores whitespace entirely when comparing lines, so
a commit that only re-indents a file shows no patch at all; -b
(--ignore-space-change) ignores changes in the amount of whitespace while still
printing Git's indentation hunk. Both re-diff through the shared libra diff
engine, so the bytes match libra diff -w / -b for the same commit.
libra log -p -w -1
libra log -p -b -1
--diff-filter=[ACDMRTUXB*]
Only show commits with at least one changed file matching the filter letters; a
lowercase letter excludes that status (so --diff-filter=a keeps commits whose
changes are not additions), and * keeps the whole record once any file matches.
The filter is applied through the shared diff engine, so it agrees with
libra diff --diff-filter. An unknown letter is LBR-CLI-002.
libra log --diff-filter=A --name-status --format=%H
libra log --diff-filter=a --oneline
--raw / --numstat
--raw prints Git's raw diff lines (:<oldmode> <newmode> <oldsha> <newsha> <status>\t<path>) for each commit instead of a patch, and --numstat prints
<insertions>\t<deletions>\t<path> (renames as {old => new}, binaries as -\t-).
Both come from the same engine as libra diff, so the bytes match the
corresponding libra diff --raw / --numstat. A later -s/--no-patch clears
them, matching Git's last-one-wins rule.
libra log --raw -1
libra log --numstat -1
--stat
Show diffstat (file change statistics) for each commit, showing insertions and deletions
per file. The change column is padded to the widest count in the block and the
summary line omits the insertion/deletion clauses that are zero, so the bytes match
git log --stat.
--shortstat
Show only the last line of the --stat output: N files changed, M insertions(+), K deletions(-) for each commit (the insertion/deletion clauses are omitted when zero),
without the per-file breakdown.
--patch-with-stat
Git's synonym for -p --stat: show the diffstat block followed by the full patch for each
commit. An explicit -p --stat combination is equivalent and likewise shows both. (The
diffstat and patch blocks follow Libra's existing --stat/-p rendering, so they differ
slightly from Git's formatting.)
libra log --stat
libra log --shortstat
libra log --patch-with-stat -1
libra log --range main..feature
libra log --all --oneline
libra log --reverse --oneline
libra log --follow src/main.rs
--author <PATTERN> / --committer <PATTERN>
Filter commits to those whose author (--author) or committer (--committer)
name or email matches the given pattern. --author and --committer may be
repeated. Patterns within one field are OR-matched; fields are ANDed with each
other and with message filters. Repeating --author does not alter how
--all-match treats --grep patterns. Matching is a case-insensitive substring
against Name <email>.
libra log --author alice
libra log --author "alice@example.com"
libra log --author alice --author bob # either author may match
libra log --committer alice --committer bob
Notes display
Built-in formats (and the default full format) show commit notes by default:
a blank line, then Notes:, then the note body indented four spaces. A
non-default ref renders Notes (<short-ref>):. --notes[=<ref>] /
--show-notes[=<ref>] select refs explicitly (giving a ref replaces the
implicit default), --no-notes suppresses them, notes.displayRef appends a
ref, and core.notesRef changes the default ref. A custom --format shows
notes only through %N (the note text, empty when absent); --json adds an
optional notes array without changing existing fields.
--grep <PATTERN> / --all-match / -i / --invert-grep
Repeated --grep patterns match if any pattern matches. The default dialect is
POSIX basic regex (Git's default), so plain text matches literally and +,
(/), . behave as Git's BRE does. --all-match requires every pattern to
match and takes no value; without any patterns it does not filter. Supplying a
value with --all-match=<value> is rejected. -F/--fixed-strings treats each
pattern as a literal, -E/--extended-regexp uses POSIX ERE, --basic-regexp
selects the default dialect explicitly, and -P/--perl-regexp is accepted but
uses the fancy-regex Perl engine (lookahead and backreferences; \K, recursion and (*VERB) are usage errors). The last flag wins.
When no dialect flag is given, grep.patternType (basic/extended/fixed) and
grep.extendedRegexp apply from the local→global→system cascade. -i /
--regexp-ignore-case makes all grep matches case-insensitive
(author/committer matching is already case-insensitive in Libra).
--invert-grep keeps commits matching none of the patterns and takes
precedence over --all-match.
The search covers the commit subject, body, and trailers. PGP or SSH signatures in
a gpgsig or gpgsig-sha256 header immediately after committer are excluded, including with -i and --invert-grep; text in
the actual message remains searchable. This applies to human, --json, and
--machine output. An empty --grep pattern matches every message; with
--invert-grep it therefore leaves no commits. All patterns are compiled
before filtering starts, and multiple invalid patterns report the first invalid
one in command-line order.
Leading spaces, tabs, and blank lines in the actual message remain searchable.
Other imported header layouts (such as encoding before gpgsig) retain the
existing parsing behavior.
libra log --grep "fix(" -n 20
libra log --grep fix --grep docs # any pattern may match
libra log --all-match --grep fix --grep docs
libra log --grep fix -i # case-insensitive
libra log --grep WIP --invert-grep # hide WIP commits
libra log -E --grep 'fix\([0-9]+\)' # ERE dialect
libra log -F --grep 'c++ (fix)' # literal pattern
libra log --basic-regexp --grep 'a\+' # explicit BRE
--trailer <KEY[=VALUE]> / --only-trailers (Libra extensions)
Git has no such flags — the nearest Git equivalents are a fragile
--grep='^Key: ' (filtering) and --pretty='%(trailers)' (display).
--trailer KEY keeps only commits whose qualifying trailer block (parsed
with Git's rules: the last paragraph, never the title; keys are ASCII
alphanumerics/dashes; a mixed block needs a recognized trailer such as
Signed-off-by and ≥25% trailer lines) carries a trailer with that key
(ASCII case-insensitive). KEY=VALUE additionally requires the exact unfolded
value. Repeatable: every --trailer must match.
--only-trailers replaces each commit's message with its trailer block
(unfolded Key: value lines; (cherry picked from commit …) lines verbatim).
It does not filter — trailer-less commits print with an empty message
section. Combined with --trailer, the display shows only the selected keys.
Mutually exclusive with --oneline/--pretty/--format.
Because this is an explicit display mode, it also overrides the
format.pretty and log.date defaults.
libra log --trailer Reviewed-by # commits reviewed by anyone
libra log --trailer Change-Id=I1234 # exact value match
libra log --only-trailers --trailer signed-off-by
In --json output every commit carries an additive trailers array
([{"key": …, "value": …}], empty when the commit has no qualifying block);
body still contains the trailer lines inline, unchanged.
--since <DATE>
Show commits more recent than the specified date.
libra log --since 2026-01-01
libra log --since "2 weeks ago"
--until <DATE>
Show commits older than the specified date.
libra log --until 2026-03-01
--pretty <FORMAT>
Custom pretty-print format string. Supports the same placeholder set described
Fixed signature-date placeholders %as/%ai/%ah and %cs/%ci/%ch render the author/committer's own timezone (short/ISO/human) and ignore --date; %ad/%cd keep following --date (now timezone-aware, including --date=human).
above, including %b, %B, %n, ASCII/control %xNN, %%, strict ISO dates %aI / %cI, raw
timestamps %at / %ct, raw decorations %D, %m, and color placeholders.
libra log --pretty="%h - %s (%an)"
libra log --pretty="format:%H %s"
libra log --pretty=%P -1
--format <FORMAT>
Alias for --pretty=<FORMAT> (Git's --format). Accepts the same preset names and
%-placeholder templates as --pretty. --oneline, --pretty, and --format are last-one-wins (the last one on the command line selects the format).
libra log --format="%h %s"
libra log --format=oneline
--decorate[=<style>]
Print ref names (branches, tags) next to commits. Styles: short (default), full, no.
Human-readable decorations are listed in the reverse order of their full ref names, with HEAD first. HEAD is shown only on the commit that HEAD points to, even when the range, --reverse or --skip starts elsewhere. The --json refs array keeps its existing order. Annotated tags are peeled through the whole tag chain, so a tag of a tag decorates the target commit alongside the inner tag. An explicit --format/--pretty containing %D/%d always requests decorations, even when stdout is not a terminal and independent of --decorate=no/--no-decorate, matching Git.
libra log --decorate
libra log --decorate=full
log.decorate accepts Git's decoration styles (no, short, full, auto) and plain
booleans: truthy values (true/yes/on/1) select short, falsy values
(false/no/off/0) disable decorations, and an unrecognized value also disables
them without an error (Git parses the style to 0). A command-line --pretty=raw or
--format=raw suppresses the configured decoration; an explicit --decorate=<style>
still wins, and a format.pretty=raw default does not suppress it.
log.excludeDecoration (repeatable) excludes matching refs from the decorations; an
explicit --decorate-refs replaces that configured filter. An empty value is Git's
empty exclusion pattern: every ref is hidden but the HEAD marker remains. Libra
cannot represent Git's valueless [log] excludeDecoration key (config values are
NOT NULL), so Git's missing value diagnostic has no equivalent here.
Decorations include remote-tracking refs (origin/main) between tags and local
branch names, matching Git's ordering.
--simplify-by-decoration
Keep only the commits referenced by a (filtered) decoration plus the repository
root(s), dropping the commits in between. --decorate-refs/--decorate-refs-exclude
narrow which references count, so the simplification follows the filtered set.
replaced decorations
A commit whose object is substituted by a replace ref is printed with its original
object id and a replaced decoration, the way Git does; the substitution only swaps
the content that is read. Replace refs live under refs/replace/ unless
GIT_REPLACE_REF_BASE points at another namespace (for example
refs/custom-replace/), and only the active namespace is consulted.
libra replace <old> <new>
libra log --oneline --decorate=short # <old> … (replaced)
Decoration colours
color.decorate.HEAD, color.decorate.branch, color.decorate.remoteBranch and
color.decorate.tag style each decoration slot, and color.diff.commit (legacy
diff.color.commit) styles the commit <id> line together with the decoration
parentheses and separators. Values are Git colour specs — a basic colour name
(black…white), attributes such as bold/dim/underline, #rrggbb, normal,
or a space-separated combination; unknown values leave the slot unstyled. The
default palette matches Git (commit yellow, HEAD bold cyan, branches bold green,
remote-tracking refs bold red, tags bold yellow).
--clear-decorations
Drop every earlier --decorate-refs/--decorate-refs-exclude and stop applying the
default decoration namespaces (so refs/notes/* decorations appear).
log.initialDecorationSet=all has the same widening effect as a default; any other
value is ignored, and refs/notes/* is hidden by default because Git's default
decoration namespaces are only HEAD, refs/heads/, refs/tags/, refs/remotes/
and refs/stash.
--no-decorate
Do not print ref names. Overrides --decorate.
libra log --no-decorate
--decorate-refs <PATTERN> / --decorate-refs-exclude <PATTERN>
Restrict decorations to refs matching any of the given patterns, or hide refs
matching any of the exclude patterns. Both options are repeatable; every value
is one complete pattern (commas are literal) with an implicit refs/ prefix, and
the pattern matches the full ref name only. A pattern with *, ? or [ is a
wildcard match; otherwise it matches the exact ref name or a prefix that ends
at a / component boundary. Exclude patterns win over include patterns. HEAD is filtered by its literal
name like any other decoration: HEAD -> <branch> is shown only when both HEAD and
the branch pass the filters; otherwise HEAD appears alone and the branch keeps
its own sorted position when it passes.
libra log --decorate --decorate-refs='tags/*'
libra log --decorate --decorate-refs='heads/aa' --decorate-refs='tags/t1'
libra log --decorate --decorate-refs-exclude='heads/*'
Migration: patterns that used the old short-name or comma-split matching must
be rewritten. origin/* becomes remotes/origin/*, refs/tags/v1,refs/tags/v2
becomes --decorate-refs='tags/v1' --decorate-refs='tags/v2'.
--graph
Draw a text-based graphical representation of the commit history using Git's
column-allocation rules: branch forks collapse with |/, two-way merges print
|\, and octopus merges print *-. plus their expansion rows. --graph
implies Git's topological (graph) order, so a commit is printed only after all
of its children; equal-date commits follow the graph-order stack (the most
recently ready commit first). --date-order and --author-date-order are
accepted but currently use the same graph order.
--all seeds the walk from every ref under refs/ (local and remote-tracking
branches, tags, and refs/notes/* references) plus HEAD, in refname order.
Libra's own notes backend stores notes in SQLite rather than a notes commit, so
only imported notes refs contribute commits.
libra log --graph
libra log --oneline --graph
libra log --graph --all
Revision ranges (positional or --range <SPEC>)
Limit history to a revision range. The range may be given positionally
(Git-style) or with the explicit --range flag. Supported forms:
A..B— commits reachable fromBbut notA.A...B— symmetric difference (commits inAorBbut not their merge base).^A(exclude) combined with an include, e.g.^A B.- Single ref, e.g.
mainorHEAD~3.
Positionally, leading arguments are revisions until the first one that is not;
everything after is treated as a pathspec, so log A..B path/ filters the range
to commits touching path/. A bare name that is both a valid revision and an
existing path is rejected as ambiguous — use --range <rev> to select the
revision. A bare token that resolves no revision, names no existing path, and
carries no pathspec syntax (:/:(...) magic or glob wildcards) is a typoed
revision: it fails with ambiguous argument '<x>': unknown revision or path not in the working tree (LBR-CLI-002, exit 129) instead of silently exiting 0. A
genuinely ambiguous short object name fails with short object ID <p> is ambiguous plus a The candidates are: hint (LBR-CLI-003, exit 129). Tokens
after -- are always pathspecs and never errors (log -- <nonexistent> exits 0
with no output; log -- HEAD treats HEAD as a path).
libra log main..feature # positional range
libra log HEAD~3..HEAD src/ # positional range + pathspec
libra log ^v1.0 HEAD # exclude + include
libra log --range main..feature # explicit flag form
--all
Show commits reachable from all local branches and tags instead of only HEAD.
libra log --all
libra log --all --oneline
--reverse
Print commits in reverse chronological order (oldest first).
libra log --reverse
libra log --reverse --oneline
--author-date-order
Order commits by author date instead of committer date (newest first). This keeps a full-history global author-date sort and does not use the default date-priority walk, so a limit does not stop that walk early. Libra sorts purely by timestamp and does not add Git's extra topological ("no parent before its children") constraint. Relative to Libra's committer-date walk the order changes only when author and committer dates differ; relative to Git it can additionally differ wherever the topological constraint would reorder commits.
libra log --author-date-order
libra log --author-date-order --oneline
--date-order
Order commits by committer date (newest first). This is Libra's default
date-priority walk, so the flag is a Git parity no-op and selects that same
walk; it conflicts with --author-date-order.
libra log --date-order
libra log --date-order --oneline
--no-expand-tabs
Do not expand tabs in the log message. Accepted no-op for Git parity: Libra
never expands tabs in commit messages (it prints them verbatim), so this already
matches the default. (Git's opposite --expand-tabs[=<n>] is not implemented.)
libra log --no-expand-tabs
--notes[=<ref>] / --no-notes
Show commit notes. Notes are appended as a Notes: block for preset formats and
expanded through the %N placeholder in --format templates. An optional
=<ref> selects a notes ref (short names expand to refs/notes/<name>; default
refs/notes/commits). --no-notes countermands an earlier --notes.
libra log -1 --notes
libra log -1 --notes=review --format='%h %s%n%N'
libra log --no-notes
--no-mailmap
Do not use a .mailmap to rewrite author/committer identities. Accepted no-op
for Git parity: Libra's log never applies a mailmap, so it already shows the raw
recorded identities. (Git's opposite --mailmap is not implemented.)
libra log --no-mailmap
--no-show-signature
Do not display the GPG signature of signed commits. Accepted no-op for Git
parity: Libra's log never displays commit signatures inline, so it already
matches the default. (Git's opposite --show-signature is not implemented.)
libra log --no-show-signature
--follow <FILE> / --no-follow
Best-effort continuation of a file's history across renames. Paths are
normalized from the current directory to the repository root. With
log.follow=true, the same traversal is enabled automatically when exactly one
positional path names an existing file; a single directory remains a normal
directory filter. --follow <FILE> and --no-follow override the config. The
config applies to human and JSON commit selection. Rename matching is exact-blob
best effort, so content-changing and complex/non-linear renames remain outside
the compatibility promise.
libra log --follow src/main.rs
libra log --no-follow src/main.rs
--parents / --children
Append commit ids after each commit hash. --parents shows each commit's parent
ids; --children shows, for each commit, the ids of the other commits in this
log's output that have it as a parent (the child map is built over the rendered
commit set, so children outside the shown range are not listed). The ids use the
same abbreviation as the commit hash and appear in the full and oneline formats.
The two flags are mutually exclusive.
libra log --oneline --parents
libra log --children
-L <RANGE:FILE>
-L <start>,<end>:<file> traces the history of a line range: only commits that
change a line inside the range are shown, and each is printed with just the hunks
that overlap it (Git-narrowed headers, including the trailing definition context
and the -0,0 numbering of creation hunks). Walk direction matters — the range is
mapped back to each parent's numbering, so commits before an insertion above the
range still match.
-L :<funcname>:<file> derives the range from the file's definitions: it starts at
the definition line and stops before the next definition (Rust fn, def,
function, and column-0 C-like signatures). An unknown name fails with
LBR-CLI-003 and Git's wording -L parameter '<name>' starting at line 1: no match;
a tracked file that does not exist fails with LBR-CLI-003 and
There is no path <file> in the commit. Combining -L with a positional
pathspec fails with -L<range>:<file> cannot be used with pathspec, and with
--follow with --follow requires exactly one pathspec (both LBR-CLI-002).
libra log -L 1,10:src/main.rs
libra log -L :parse_line_range:src/command/log.rs
[PATHS...]
Limit diff output to the specified paths. Used with -p, --name-only, --name-status,
--stat, or --shortstat. Paths match through the shared pathspec engine, so plain
prefixes, wildcards, and the :(top)/:(glob)/:(literal)/:(icase)/:(exclude)
magic forms all work; --literal-pathspecs / GIT_LITERAL_PATHSPECS turns them
literal.
libra log -- src/
libra log -p -- src/main.rs tests/
Common Commands
libra log
libra log -n 5
libra log --oneline --graph
libra log --author alice --since 2026-01-01
libra log --name-status src/
libra --json log -n 1
Human Output
Default human mode shows commits in a detailed multi-line format:
commit abc1234def5678901234567890abcdef12345678 (HEAD -> main, origin/main)
Author: Test User <test@example.com>
Date: Sat Mar 30 10:00:00 2026 +0800
Add new feature
Oneline format:
abc1234 (HEAD -> main) Add new feature
def5678 Fix bug in parser
Graph format:
* abc1234 (HEAD -> main) Add new feature
* def5678 Fix bug in parser
|\
| * 1234567 Feature branch commit
|/
* 7890abc Initial commit
--quiet suppresses all human output.
Structured Output
--json / --machine returns a filtered, structured commit list:
{
"ok": true,
"command": "log",
"data": {
"commits": [
{
"hash": "abc123...",
"short_hash": "abc1234",
"author_name": "Test User",
"author_email": "test@example.com",
"author_date": "2026-03-30T10:00:00+08:00",
"committer_name": "Test User",
"committer_email": "test@example.com",
"committer_date": "2026-03-30T10:00:00+08:00",
"subject": "base",
"body": "",
"parents": [],
"refs": ["HEAD -> main"],
"files": [
{ "path": "tracked.txt", "status": "added" }
]
}
],
"total": 1
}
}
Schema Notes
-nalso applies in JSON modetotalreflects the filtered commit count only when-nis not supplied; with-n, it is alwaysnull--graph,--pretty, and--onelinedo not change the JSON schemaformat.prettyandlog.datedo not change the JSON schema;log.followcan change which commits are selected for a single positional path--decorateonly affects human rendering; JSON always returns arefsarray, and auxiliary ref metadata is collected best-effortfilesis always a structured change summary and never includes patch text
Design Rationale
Positional revision ranges and the --range alternative
Git accepts git log A..B where the revision expression is a positional argument,
optionally followed by pathspecs. Libra supports this positional form: tokens
after -- are always pathspecs — they never error, even when they name nothing
(log -- <nonexistent> exits 0 with no output), and even a name that would
otherwise be a revision is a plain path here (log -- HEAD). Before --,
leading arguments are classified as revisions (by resolving them) until the
first non-revision, after which the rest are pathspecs. The split is by
resolution: a range-syntax token (A..B/A...B/^A) is a revision when it
resolves, a pathspec when it does not resolve but names an existing path (e.g.
../file) or carries pathspec magic/glob syntax, and otherwise an error (a
typoed revision exits non-zero as an unknown revision/path rather than silently
filtering by a missing path). A bare token is a revision only if it resolves to
a commit; a genuinely ambiguous short object name surfaces the shared ambiguity
diagnostic instead of being reclassified as a path; a bare name that is both
a revision and an existing path is rejected as ambiguous. The explicit
--range A..B flag remains as an unambiguous alternative and is the way to
force a name that also matches a path to be treated as a revision.
--all implementation
--all enumerates local branches and lightweight tags from the SQLite
reference table, collects their tip commits, and walks the union of those
histories.
--reverse
--reverse collects the filtered commits and prints them oldest-first. It
applies after all other filters, so -n still limits the result set.
--author-date-order
--author-date-order keeps the previous full collect and sorts that set by
author timestamp (newest first). It does not use the date-priority walk, and
-n does not stop the walk early. The sort is purely by timestamp — Libra does
not impose Git's topological constraint — so it diverges from the default only
when a commit's author and committer dates differ (e.g. after a rebase or
cherry-pick). --reverse still flips the final ordering.
--date-order
--date-order selects the default committer-date priority walk. It is a parity
no-op (the same key and the same walk as a plain libra log) and conflicts with
--author-date-order.
Date-priority walk
Default libra log and --date-order walk history with a priority queue keyed
by committer timestamp, newest first. When two commits share a timestamp, the
one discovered earlier is shown first. On histories with no clock skew and no
same-second ties, that order matches a global newest-first sort. On skewed or
same-second histories it matches Git's date-priority walk and can differ from a
global sort (for example M at time 10 with parents P1 at 5 and P2 at 9,
where P1's parent A and P2's parent B are also at time 5, prints
M, P2, P1, B, A).
log -n N is a prefix of unlimited log for that walk. An eligible limit,
including --skip, stops after producing skip + N commits. These calls are
not eligible and still walk the whole reachable history: --graph,
--children, --reverse, --author-date-order, --follow (and
log.follow=true when it resolves to exactly one existing file), -L, a
pathspec, --author / --committer / --grep / --since / --until,
pickaxe (-S / -G), --merges / --no-merges / --min-parents /
--max-parents, --trailer, a revision range with an excluded side, --all,
and more than one revision tip. log.follow=true with no pathspec stays
eligible.
An eligible log -n N loads parents when it enqueues them. If a missing
ancestor is deeper than that frontier, the command prints the reachable prefix
and succeeds. A full walk still fails when it reaches the missing object.
Eligible limited logs choose the abbreviated hash length from the commits they
print, with a minimum of 7. Unlimited logs and ineligible commands still use
every reachable commit. In a repository where a 7-character prefix is unique
among the printed commits but not among the whole history, log --oneline -n N
can print a shorter abbreviation than log --oneline.
A range such as A..B still walks the exclusion closure before the shown
commits. Debug builds can record how many commit objects that walk parsed by
setting LIBRA_TEST_LOG_COMMITS_LOADED_PATH to a file path. That count includes
the exclusion closure, so it is larger than rev-list A..B --count by the size
of the closure. LIBRA_TEST_LOG_ABBREV_BASIS_COUNT_PATH records how many commits
were used to choose the abbreviation length.
--follow
--follow is a boolean flag: the single pathspec names the file whose history is
traced through renames. No pathspec, or more than one, fails with LBR-CLI-002
and Git's wording --follow requires exactly one pathspec. The deprecated
--follow=<FILE> spelling keeps working for existing scripts and is equivalent
to --follow -- <FILE>.
libra log --follow --oneline -- b.txt
libra log --follow=b.txt --oneline
--follow
--follow performs best-effort rename detection by walking history backwards,
switching to an exact-blob predecessor path at a rename. It does not handle
complex directory renames, content-changing/content-similar renames, or every
non-linear-history case.
-L
-L is parsed and accepted; full blame-level line attribution is not yet
implemented. The flag acts as a path filter in the current release.
--graph with text rendering
Libra implements --graph as a text-based ASCII/Unicode graph renderer, similar to Git's
built-in graph output. Unlike GUI tools (GitKraken, SourceTree) or Git's --format with
external graph renderers, Libra's graph is rendered inline in the terminal. This keeps the
CLI self-contained and ensures consistent output across platforms. The graph renderer handles
branching, merging, and octopus merges, drawing connecting lines between parent and child
commits.
JSON always returns refs array regardless of --decorate
In human output, --decorate controls whether ref names (branch, tag) are shown next to
commit hashes. In JSON mode, the refs array is always populated regardless of the
--decorate flag. This design choice reflects the principle that JSON output should be
maximally informative for programmatic consumers. An AI agent or CI tool parsing JSON output
should not need to remember to pass --decorate to get ref information. The --decorate
flag only affects the human rendering layer.
Parameter Comparison: Libra vs Git vs jj
| Parameter / Flag | Git | jj | Libra |
|---|---|---|---|
| Show log | git log |
jj log |
libra log |
| Limit count | git log -n <N> |
jj log -n <N> |
libra log -n <N> |
| Oneline format | git log --oneline |
Default format is oneline | libra log --oneline |
| Abbreviated hash | git log --abbrev-commit |
Default | libra log --abbrev-commit |
| Abbrev length | git log --abbrev=<N> |
N/A | libra log --abbrev <N> |
| Full hash | git log --no-abbrev |
jj log --no-short-hash |
libra log --no-abbrev / --no-abbrev-commit |
| Show patch | git log -p |
jj diff -r <rev> (separate cmd) |
libra log -p / --patch |
| Name only | git log --name-only |
N/A | libra log --name-only |
| Name and status | git log --name-status |
N/A | libra log --name-status |
| NUL path output | git log -z --name-status |
N/A | libra log -z --name-status |
| Diffstat | git log --stat |
jj diff --stat -r <rev> |
libra log --stat |
| Short diffstat | git log --shortstat |
N/A | libra log --shortstat |
| Filter by author | git log --author=<pat> |
jj log --author <pat> (revset) |
libra log --author <pat> |
| Since date | git log --since=<date> |
Revset expression | libra log --since <date> |
| Until date | git log --until=<date> |
Revset expression | libra log --until <date> |
| Custom format | git log --pretty=<fmt> / --format=<fmt> |
jj log -T <template> |
libra log --pretty <fmt> / --format <fmt> |
| Decorate refs | git log --decorate |
Always shown | libra log --decorate |
| No decorate | git log --no-decorate |
N/A | libra log --no-decorate |
| Graph view | git log --graph |
jj log (default has graph) |
libra log --graph |
| All refs | git log --all |
jj log -r 'all()' |
libra log --all |
| Branches only | git log --branches |
jj log -r 'branches()' |
N/A |
| Remotes only | git log --remotes |
jj log -r 'remote_branches()' |
N/A |
| Revision range | git log A..B |
jj log -r 'A..B' |
libra log A..B (positional) or libra log --range A..B |
| Grep message | git log --grep=<pat> |
Revset description() |
libra log --grep <pat> |
| Case-insensitive grep | git log -i --grep=<pat> |
N/A | libra log -i --grep <pat> |
| Invert grep | git log --invert-grep --grep=<pat> |
N/A | libra log --invert-grep --grep <pat> |
| Path filter | git log -- <paths> |
N/A (use revset) | libra log -- <paths> |
| Reverse order | git log --reverse |
jj log --reversed |
libra log --reverse |
| Author-date order | git log --author-date-order |
N/A | libra log --author-date-order (full-history author-date sort) |
| Date order | git log --date-order |
N/A | libra log --date-order (parity no-op; committer-date priority walk) |
| Follow renames | git log --follow <file> |
N/A | libra log --follow <file> |
| Structured JSON output | N/A | N/A | --json / --machine |
| Error hints | Minimal | Minimal | Every error type has an actionable hint |
Error Handling
| Scenario | Error Code | Exit | Hint |
|---|---|---|---|
| Outside a repository | LBR-REPO-001 |
128 | -- |
| Empty branch or empty HEAD | LBR-REPO-003 |
128 | "create a commit first before running 'libra log'" |
| Invalid date argument | LBR-CLI-002 |
129 | -- |
Invalid --decorate option |
LBR-CLI-002 |
129 | -- |
--all-match supplied with a value |
LBR-CLI-002 |
129 (Git: 128) | Libra: error: unexpected value '1' for '--all-match' found; no more were expected; Git: fatal: unrecognized argument: --all-match=1 |
Invalid --grep pattern (first invalid pattern is reported) |
LBR-CLI-002 |
129 (Git: 128) | Libra: fatal: invalid --grep pattern '<pattern>': …; Git: fatal: command line, '<pattern>': … |
--no-abbrev supplied with a value |
LBR-CLI-002 |
129 | -- |
A name output option conflicts with active -s/--no-patch, or both name options remain active |
LBR-CLI-002 |
129 | -- |
| Invalid object name | LBR-CLI-003 |
129 | "check the revision name and try again" |
| Unresolvable positional revision (typo guard) | LBR-CLI-002 |
129 | "unknown revision or path not in the working tree" |
| Ambiguous short object name | LBR-CLI-003 |
129 | "The candidates are: ..." (one <abbrev> <type> line per candidate) |
| Corrupted commit/tree/blob | LBR-REPO-002 |
128 | -- |
| Failed to read historical objects | LBR-REPO-002 |
128 | -- |
Compatibility Notes
--branchesand--remotesare not yet implemented--alltraverses local branches and lightweight tags; remote tracking refs and stashes are not included- Revision range syntax is available both positionally (
libra log A..B/A...B/^A) and via the explicit--range A..Bflag. Tokens after--are always pathspecs and never errors; before--the positional rev/path split is by resolution: a token that resolves no revision, names no existing path, and carries no pathspec syntax is a typoed revision and fails with exit 129 (LBR-CLI-002) — it never silently exits 0; a genuinely ambiguous short object name fails with the shared candidates diagnostic (LBR-CLI-003, 129); a bare name that is both a revision and a path is rejected as ambiguous (use--rangeto force the revision) --followuses best-effort rename detection and may miss complex renames-Lis accepted but does not yet provide blame-level line precision--reverseis supported--author-date-orderkeeps a full-history author-date sort (timestamp-only; no topological constraint; a limit does not stop the walk early)--date-orderis a parity no-op for the default committer-date priority walk- Eligible
log -n Nis a prefix of unlimitedlogand abbreviates hashes from the printed commits (minimum 7). Skewed or same-second histories follow discovery order, and a missing ancestor beyond the limited frontier no longer fails the command - jj's log uses a template language (
-T) for formatting; Libra uses Git-compatible--prettyformat strings - In JSON mode,
filescontains structured change summaries; patch text is never included in JSON output
--separate-git-dirpointer layouts are supported: when<worktree>/.librais agitdir: <dir>pointer file (created bylibra clone --separate-git-dir), this command resolves the real metadata directory and reads<dir>/libra.dband<dir>/objectsinstead of<worktree>/.libra.