@@ -4093,7 +4093,38 @@ that not only specifies their type, but also provides size information
40934093about the data in the object. It's worth noting that the SHA-1 hash
40944094that is used to name the object is the hash of the original data
40954095plus this header, so `sha1sum` 'file' does not match the object name
4096- for 'file'.
4096+ for 'file' (the earliest versions of Git hashed slightly differently
4097+ but the conclusion is still the same).
4098+
4099+ The following is a short example that demonstrates how these hashes
4100+ can be generated manually:
4101+
4102+ Let's assume a small text file with some simple content:
4103+
4104+ -------------------------------------------------
4105+ $ echo "Hello world" >hello.txt
4106+ -------------------------------------------------
4107+
4108+ We can now manually generate the hash Git would use for this file:
4109+
4110+ - The object we want the hash for is of type "blob" and its size is
4111+ 12 bytes.
4112+
4113+ - Prepend the object header to the file content and feed this to
4114+ `sha1sum`:
4115+
4116+ -------------------------------------------------
4117+ $ { printf "blob 12\0"; cat hello.txt; } | sha1sum
4118+ 802992c4220de19a90767f3000a79a31b98d0df7 -
4119+ -------------------------------------------------
4120+
4121+ This manually constructed hash can be verified using `git hash-object`
4122+ which of course hides the addition of the header:
4123+
4124+ -------------------------------------------------
4125+ $ git hash-object hello.txt
4126+ 802992c4220de19a90767f3000a79a31b98d0df7
4127+ -------------------------------------------------
40974128
40984129As a result, the general consistency of an object can always be tested
40994130independently of the contents or the type of the object: all objects can
@@ -4123,7 +4154,8 @@ $ git switch --detach e83c5163
41234154----------------------------------------------------
41244155
41254156The initial revision lays the foundation for almost everything Git has
4126- today, but is small enough to read in one sitting.
4157+ today (even though details may differ in a few places), but is small
4158+ enough to read in one sitting.
41274159
41284160Note that terminology has changed since that revision. For example, the
41294161README in that revision uses the word "changeset" to describe what we
0 commit comments