2. Everything is named by its content
An object's name is the hash of its bytes, so identical content has the same name everywhere, any change produces a new name, and tampering can always be proved.

2. Everything is named by its content

An object's name is the hash of its bytes, so identical content has the same name everywhere, any change produces a new name, and tampering can always be proved.

This is why clones agree, why commits are immutable, and why a name is a guarantee.

Give Git a file. It runs the content through a hash function. Out come forty characters.

That is the file's name inside Git. Not a number Git picked. A fingerprint of the content. Not of who made it.

The same content gives the same name. On your laptop. On a server. In ten years.

Change one byte, and the name changes completely.

So nothing can be altered quietly. If the content differs, the name no longer matches. Git can prove it.

Check yourself. Two people commit the same file on different machines. What can you say about the file's name in each repository?

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime

Connections0

Connections show where other documents or comments link to this document.

Related documents

Loading connections…