git hash-object

A low-level command that prints the object ID Git would give some content, and can store it with -w.

In more detail

git hash-object report.md shows the blob ID for that file, and --stdin reads the content from standard input instead. With -t commit it hashes text as a commit, which proves a commit ID is simply the hash of the commit's text.

Example

printf 'Revenue is up.\n' | git hash-object --stdin

Related terms

Taught in

References