About
blob in git is a object of the blob type that corresponds / represents the file contents (or inodes) in the git file system.
Possible duplicate of file
Management
Put
This command will put a blob in the object database
echo 'test content' | git hash-object -w --stdin
where:
- the hash known as hash-object generates the hash (file unique identifier)
- the w option write that object to the database
- the stdin option to accept data from the standard input stream
Output:
d670460b4b4aece5915caf5c68d12f560a9fe3e4
The output is a 40-character:
- a SHA-1 checksum hash of the content
- plus a header
On the file system, you can see its location in the sub-directory object directory from the repository.
find .git/objects -type f
.git/objects/d6/70460b4b4aece5915caf5c68d12f560a9fe3e4
Get
git cat-file -p d670460b4b4aece5915caf5c68d12f560a9fe3e4
where
- cat-file is the equivalent of the cat utility
- the p option to determine automatically the mime