LibraLibra
LibraLibra
DocsBlogLibra
Getting Started
Architecture
Design
Commands
libra addlibra agentlibra alternateslibra applylibra archivelibra authlibra automationlibra bisectlibra blamelibra branchlibra bundlelibra cachelibra cat-filelibra check-attrlibra check-ignorelibra check-mailmaplibra checkoutlibra cherry-picklibra cleanlibra clonelibra cloudlibra code-controllibra codelibra commit-treelibra commitlibra completionslibra configlibra credentiallibra depslibra describelibra diff-fileslibra diff-indexlibra diff-treelibra difflibra dirtylibra fast-exportlibra fast-importlibra fetchlibra filelibra for-each-reflibra format-patchlibra fscklibra gclibra graphlibra greplibra hash-objectlibra hookslibra hydratelibra index-packlibra initlibra investigatelibra layerlibra lfslibra loglibra logfilelibra loginlibra logoutlibra ls-fileslibra ls-remotelibra ls-treelibra maintenancelibra medialibra merge-baselibra merge-filelibra mergelibra metadatalibra mvlibra noteslibra oplibra openlibra pack-objectslibra packagelibra prunelibra publishlibra pulllibra pushlibra read-treelibra rebaselibra refloglibra remotelibra repacklibra replacelibra rererelibra resetlibra restorelibra rev-listlibra rev-parselibra revertlibra reviewlibra revisionlibra rmlibra sandboxlibra servicelibra shortloglibra show-reflibra showlibra sparse-viewlibra stashlibra statslibra statuslibra switchlibra symbolic-reflibra taglibra update-indexlibra update-reflibra usagelibra verify-packlibra whoamilibra worktreelibra write-tree
API Reference
Policy
Commands

libra show

Command reference for `libra show`

Show a commit, tag, tree, blob, or the blob referenced by REV:path.

Synopsis

libra show [OPTIONS] [OBJECT] [-- <PATHS>...]

Description

libra show resolves a single object reference and renders its contents. The default target is HEAD. It understands commit-ish references (HEAD~2, branch names, tag names), raw SHA-1 hashes, and the REV:path syntax for extracting a specific blob from a tree at a given revision.

For commits the output includes the header (author, committer, date, message) followed by a unified diff (the "patch"). Flags such as --no-patch, --stat, and --name-only control how much diff context is shown. For annotated tags the tagger metadata and message are printed, followed by the target object. Trees list their entries and blobs print their text content (or a binary summary).

Options

FlagShortDescription
<OBJECT>Object name (commit, tag, tree, blob) or <object>:<path>. Defaults to HEAD.
--no-patch-sSkip patch output and only show object metadata.
--onelineShorthand for --pretty=oneline -- prints hash and subject on one line.
--pretty <FORMAT>Format the commit header with a preset (oneline) or a %-placeholder template (format:/tformat:/bare).
--format <FORMAT>Alias for --pretty=<FORMAT> (Git's --format). Mutually exclusive with --pretty.
--abbrev-commitAbbreviate the commit object name in the default header to a 7-character prefix.
--no-abbrev-commitShow the full (unabbreviated) commit object name, countermanding an earlier --abbrev-commit (last one wins). The full hash is the default, so on its own this is a no-op.
--name-onlyShow only changed file names (no diff hunks).
--name-statusShow changed file names prefixed by a status letter (A/M/D), tab-separated.
--rawShow the raw diff format :<old-mode> <new-mode> <old-sha> <new-sha> <status>\t<path> (object ids abbreviated to 7) instead of a patch, like git show --raw.
--statShow diff statistics (insertions / deletions per file).
--patch-with-statShow the diffstat block followed by the full patch (Git's legacy synonym for -p --stat).
--summaryShow a condensed summary of created and deleted files (their mode and path), like git show --summary. Created/deleted files only — no rename/copy detection.
--no-expand-tabsDo not expand tabs in the commit message. Accepted no-op: Libra's show prints tabs verbatim.
--no-notesDo not show commit notes. Accepted no-op: Libra's show never displays notes inline.
--no-mailmapDo not apply a .mailmap. Accepted no-op: Libra's show shows the raw recorded identities.
--no-show-signatureDo not display the GPG signature of signed commits. Accepted no-op: Libra's show never displays commit signatures inline. (Git's --show-signature is not implemented.)
<PATHS>...Limit output to matching paths (pathspec filter for commit diffs).

Examples

# Show the latest commit with full patch
libra show HEAD

# Show only metadata (no diff) for a tag
libra show --no-patch v1.0.0

# Show a specific file from a revision
libra show HEAD:src/main.rs

# One-line summary of a commit
libra show --oneline abc1234

# Diff statistics only
libra show --stat HEAD~1

# Limit diff to a subdirectory
libra show HEAD -- src/command/

Common Commands

libra show                          # show HEAD commit and patch
libra show HEAD~3                   # show an ancestor commit
libra show -s v2.0.0                # metadata only for a tag
libra show HEAD:Cargo.toml          # print a file at HEAD
libra show --name-only HEAD         # list changed files
libra show --name-status HEAD       # list changed files with A/M/D status
libra show --stat HEAD              # diff statistics
libra show --patch-with-stat HEAD   # diffstat followed by the full patch
libra show --summary HEAD           # created/deleted file mode summary
libra --json show HEAD              # structured JSON output

Human Output

Human mode preserves the existing presentation:

  • Commit: header plus optional patch / stat / name-only output
  • Annotated tag: tag metadata followed by the target object
  • Tree: list of tree entries
  • Blob: text content or a binary summary
  • --quiet: validates the object reference but suppresses human output
  • Human output uses the shared pager policy; pass global --no-pager to force direct stdout

Structured Output (JSON examples)

data.type determines the schema. Possible values: commit, tag, tree, blob.

Commit

{
  "ok": true,
  "command": "show",
  "data": {
    "type": "commit",
    "hash": "abc1234def5678901234567890abcdef12345678",
    "short_hash": "abc1234",
    "author_name": "Alice",
    "author_email": "[email protected]",
    "author_date": "2026-04-01T10:00:00+00:00",
    "committer_name": "Alice",
    "committer_email": "[email protected]",
    "committer_date": "2026-04-01T10:00:00+00:00",
    "subject": "feat: add new feature",
    "body": "",
    "parents": ["def456..."],
    "refs": ["HEAD -> main"],
    "files": [
      { "path": "tracked.txt", "status": "added" }
    ]
  }
}

Tag

{
  "ok": true,
  "command": "show",
  "data": {
    "type": "tag",
    "tag_name": "v1.0.0",
    "tagger_name": "Alice",
    "tagger_email": "[email protected]",
    "tagger_date": "2026-04-01T10:00:00+00:00",
    "message": "Release v1.0.0",
    "target_hash": "abc1234def5678901234567890abcdef12345678",
    "target_type": "commit"
  }
}

Tree

{
  "ok": true,
  "command": "show",
  "data": {
    "type": "tree",
    "entries": [
      { "mode": "100644", "object_type": "blob", "hash": "abc123...", "name": "README.md" },
      { "mode": "040000", "object_type": "tree", "hash": "def456...", "name": "src" }
    ]
  }
}

Blob

{
  "ok": true,
  "command": "show",
  "data": {
    "type": "blob",
    "hash": "abc123...",
    "size": 1024,
    "is_binary": false,
    "content": "fn main() { ... }"
  }
}

Notes:

  • Commit JSON refs are best-effort decoration metadata; unrelated branch/tag rows no longer block show
  • Human --quiet still validates the target object but suppresses stdout and does not initialize the pager
  • Commit patch / stat paths stay strict: corrupt historical blobs fail with LBR-REPO-002 instead of falling back to working tree contents

Design Rationale

Why support REV:path syntax?

The REV:path notation (e.g., HEAD:src/main.rs) is one of the most useful idioms in Git because it lets users and tools retrieve any file at any point in history without checking out an entire commit. For AI agents this is especially valuable: an agent can read specific files at specific revisions to compare implementations across branches or time, without mutating the working tree. Libra preserves this syntax for full Git compatibility and because it maps naturally to the internal tree-walk operation that Libra already performs.

--pretty / --format and structured JSON

--pretty=<fmt> and its alias --format=<fmt> render the commit header with the oneline preset or a %-placeholder template (format:/tformat:/bare), sharing libra log's formatter. The named presets short, full, fuller, reference, and raw are rendered distinctly (matching Git's preset structure); medium maps to the default format. (This is separate from the --raw diff format — see the --raw option — which selects the raw :<old-mode> <new-mode> … diff format instead of a preset.) For programmatic consumers, --json remains the recommended interface: it gives every field in a well-typed, type-discriminated schema (typed fields vs. string parsing), avoiding format-string fragility.

Why type-aware JSON schema?

The data.type discriminator (commit, tag, tree, blob) means that JSON consumers can switch on the type and access only the fields that exist for that object kind. This is more ergonomic than a flat schema with many nullable fields, and it mirrors the object model of Git itself. Each variant carries exactly the fields that make sense (e.g., tagger_name appears only in tags, parents only in commits), which eliminates an entire class of "field is null but I expected it" bugs in agent tooling.

Parameter Comparison: Libra vs Git vs jj

FeatureLibraGitjj
Default targetHEADHEADN/A (jj show removed; use jj log -r @)
REV:path syntaxYesYesNo (use jj file show -r REV path)
--no-patch / -sYesYesN/A
--onelineYesYesN/A (use jj log --template)
--name-onlyYesYesN/A
--statYesYesN/A (jj diff --stat -r REV)
--patch-with-statYesYesN/A
--pretty / --formatYes (oneline + %-templates; presets pending)YesNo (use templates)
--abbrev-commitYesYesN/A
--quietYes (validates only)NoN/A
JSON output--json with typed schemaNoNo
Pathspec filterYes (trailing <PATHS>...)YesNo (use jj diff --from/--to)
Tag-aware displayAuto-detects annotated tagsAuto-detects annotated tagsNo tag objects

Error Handling

ScenarioStableErrorCodeExit
Outside a repositoryLBR-REPO-001128
Invalid revision or missing pathLBR-CLI-003129
Failed to read the objectLBR-REPO-002128

libra show-ref

Command reference for `libra show-ref`

libra sparse-view

Command reference for `libra sparse-view`

On this page

SynopsisDescriptionOptionsExamplesCommon CommandsHuman OutputStructured Output (JSON examples)CommitTagTreeBlobDesign RationaleWhy support REV:path syntax?--pretty / --format and structured JSONWhy type-aware JSON schema?Parameter Comparison: Libra vs Git vs jjError Handling