Skip to content
The Git Crypt

/static/cripta/en/ossada/cat-file-p/

Menu

GIT-011 · Plumbing

git cat-file -p

Opens any object in the vault and shows what's inside.

Everything in git is one of four objects — blob, tree, commit, tag — kept in a hash-addressed vault. cat-file -p (pretty-print) opens any of them: a commit shows tree, parents, author and message; a tree lists its entries; a blob dumps its content.

It is the crypt's flashlight: half a dozen invocations — HEAD, then HEAD^{tree}, then a hash from the listing — and git's entire data model stops being an abstraction. No mystery survives a patient cat-file.

$ git cat-file -t HEAD
commit
$ git cat-file -p HEAD^{tree}
100644 blob e3c9a1f7…	main.go
040000 tree 91d2f7a3…	templates
The latest commit's tree, cracked open.