FahamLah

Commands

git hash-object

git hash-object [-w] <file>

Risk: Safe

What it does

Prints the id Git gives a file's content.

When to use it

To see that the same content always gets the same id.

Example

$ git hash-object index.html

Print the blob id of index.html. Nothing is saved.

$ git hash-object -w notes.txt

Also save the content in Git as a blob.