What does `cat-file` stand for in git?

to read the content ( or blob ) of a git object

git cat-file -p <SHA1>

to read its type

git cat-file -t <SHA1>

While cat does stand for "concatenate", what it actually does is simply display one or multiple files, in order of their appearance in the command line arguments to cat. The common pattern to view the contents of a file on Linux or *nix systems is:

cat <file>

The main difference between cat and Git's cat-file is that it only displays a single file (hence the -file part). Git's cat-file doesn't really stand for "concatenate"; it simply is a reference to the behavior of the cat command.

git-cat-file - Provide content or type and size information for repository objects

Technically, you can use git cat-file to concatenate files, if you use Batch Output mode:

BATCH OUTPUT

If --batch or --batch-check is given, cat-file will read objects from stdin, one per line, and print information about them. By default, the whole line is considered as an object, as if it were fed to git-rev-parse[1].

Tags:

Git