HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

git cat-file — Provide content or type and size information for Git repository objects. More information: <https://

Submitted by: @import:tldr-pages··
0
Viewed 0 times
git cat-filecommandandcontentclisizetypeprovide

Problem

How to use the git cat-file command: Provide content or type and size information for Git repository objects. More information: <https://git-scm.com/docs/git-cat-file>.

Solution

git cat-file — Provide content or type and size information for Git repository objects. More information: <https://git-scm.com/docs/git-cat-file>.

Get the [s]ize of the HEAD commit in bytes:
git cat-file -s HEAD


Get the [t]ype (blob, tree, commit, tag) of a given Git object:
git cat-file -t {{8c442dc3}}


Pretty-[p]rint the contents of a given Git object based on its type:
git cat-file -p {{HEAD~2}}

Code Snippets

Get the [s]ize of the `HEAD` commit in bytes

git cat-file -s HEAD

Get the [t]ype (blob, tree, commit, tag) of a given Git object

git cat-file -t {{8c442dc3}}

Pretty-[p]rint the contents of a given Git object based on its type

git cat-file -p {{HEAD~2}}

Context

tldr-pages: common/git cat-file

Revisions (0)

No revisions yet.