Sha1 is irreversible. Why can git cat-file-p < SHA1 value > restore the contents of the file?

sha1 is irreversible. Why can git cat-file-p < SHA1 value > restore the contents of the file?

Git
Mar.10,2021

is not a restore, because the hash value here is only an index (globally uniquely identifies what), git reads from the file


generates the file's SHA1 value based on file, and this value can basically be considered to be unique, and the sha1 value is the corresponding relationship between sha1 and file in the changed
git system for each modification of the file. Therefore, you can directly take the sha1 to the specific file content

.
Menu