LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

git-cat-file

Display content or metadata of repository objects

TLDR

Show object type
$ git cat-file -t [object]
copy
Show object size
$ git cat-file -s [object]
copy
Show object content
$ git cat-file -p [object]
copy
Show blob content
$ git cat-file blob [hash]
copy
Show commit content
$ git cat-file commit [hash]
copy
Show tree content
$ git cat-file tree [hash]
copy
Batch-print info and content for objects on stdin
$ git cat-file --batch
copy
Batch-check type and size for objects on stdin
$ git cat-file --batch-check
copy

SYNOPSIS

git cat-file [options] object

DESCRIPTION

git cat-file provides direct access to Git's object database, allowing inspection of blobs, trees, commits, and tags. This low-level plumbing command reveals the internal structure of Git's content-addressable storage system.The command operates on object hashes (SHA-1 or SHA-256) and can display object type, size, or pretty-printed content. It's essential for debugging repository corruption, understanding Git internals, and forensic analysis of repository history.Common use cases include examining specific versions of files without checking them out, inspecting tree structures to understand directory layouts at specific commits, and validating object integrity. The -p flag pretty-prints objects in human-readable format, while -t and -s provide metadata without full content extraction.

PARAMETERS

-t

Show object type.
-s
Show object size.
-p
Pretty-print content.
-e
Exit with zero status if the object exists and is valid.
--batch
Print object info and content for each object id read from stdin.
--batch-check
Print object type and size for each object id read from stdin.
--textconv
Show content as transformed by a configured textconv filter.
blob
Show blob.
commit
Show commit.
tree
Show tree.

INSTALL

sudo apt install git
copy
sudo dnf install git
copy
sudo pacman -S git
copy
sudo apk add git
copy
sudo zypper install git
copy
brew install git
copy
nix profile install nixpkgs#git
copy

SEE ALSO

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid