git-show-index
Show packed Git archive index content
TLDR
Read an IDX file for a Git packfile and dump its contents to stdout
Specify the hash algorithm for the index file (experimental)
SYNOPSIS
git show-index [--object-format=<format>] [--stdin] [<index.file>]
PARAMETERS
--object-format=<format>
Specify hash format for object names (sha1 default, sha256 supported)
--stdin
Read index from standard input (default if no file argument)
DESCRIPTION
git show-index is a low-level plumbing command in Git that parses an index file (the staging area, usually .git/index) and outputs its contents in a stable, text-based format suitable for machine processing by other Git tools.
The index stores entries with file metadata: paths, modes (permissions), object hashes (SHA-1 or SHA-256), stage numbers, and flags. Each entry is printed on one line:
%06o SP %s TAB %04X SP %s NUL
Where:
• %06o is the file mode in octal (e.g., 100644).
• %s is the object name (40 hex chars for SHA-1).
• TAB separator.
• %04X is flags as 4-digit uppercase hex (little-endian uint32).
• SP then pathname, terminated by NUL byte.
This format enables piping to commands like git commit-tree. It supports different object formats via --object-format. Primarily for scripting and debugging, not user-facing display (use git ls-files for that). Output is NUL-terminated lines, ideal for xargs -0.
CAVEATS
Plumbing command with stable but machine-oriented output; NUL-terminated lines require tools like xargs -0. Not for human-readable display.
OUTPUT EXAMPLE
100644 TAB 4b825dc642cb6eb9a060e54bf8d69288fbee4904 TAB 0000 SP path/to/file NUL
SEE ALSO
git-ls-files(1), git-update-index(1), git-commit-tree(1)


