What is a Git blob object?

Definition

A Git blob contains raw file data. File names, modes and placement are stored by tree objects that point to the blob's object ID.

Because blobs are content-addressed, identical file content can be reused across directories, branches and commits. Metadata such as renames is inferred from repository history rather than stored in the blob.

ELI5

A Git blob object stores the contents of a file without its name or folder location. A separate tree object records where that content appears and what the file is called.

For example, two files with identical contents can point to the same blob even if they have different paths. This content-based storage saves duplication, while rename information is inferred from changes between commits rather than stored in the blob.

Does a Git blob store a file name?

No. The blob stores content, while a tree object associates that content with a name and file mode.

Can one Git blob be used by several commits?

Yes. Any tree can reference the same blob object when the underlying file content is identical.

  1. Why Git Hosting Is Hard beside a flat diagram of replicated repository servers and a latency bottleneck
Definition card for Git blob object: What is a Git blob object?

A Git blob object stores the content of a file without its file name or directory location.