Git Internals
July 17, 2020
https://book.git-scm.com/book/en/v2/Git-Internals-Git-Objects
Plumbing commands #
Put object into the git db #
$ echo 'test content' | git hash-object -w --stdin
d670460b4b4aece5915caf5c68d12f560a9fe3e4
-wmeans actually write it in--stdinrequired (otherwise the git hash-object command expects filename as 2nd arg)
The key returned is the SHA-1 key used to reference things in the .git/objects/ folder. This hash is 40-characters long with a header (2 chars) and payload (38 chars).