- Sep 29, 2004
- 18,656
- 68
- 91
Git uses checksums for versioning. Specifically, SHA-1 which is 160 bits or 20 bytes.
Why is it that on commit, the checksum returned is 7 characters of hex? That's only 28 bits.
So what exactly is that hashcode that commit is providing?
From the pro git documentation:
Now you’ve created your first commit! You can see that the commit has given
you some output about itself: which branch you committed to (master),
what SHA-1 checksum the commit has (463dc4f), how many files were
changed, and statistics about lines added and removed in the commit. - page 55 of version 2.25 of the PDF file
The underlined statement is a contradiction.
EDIT: I think I found out ... commit only gives the last 7 hex characters (for some stupid reason)
Why is it that on commit, the checksum returned is 7 characters of hex? That's only 28 bits.
So what exactly is that hashcode that commit is providing?
From the pro git documentation:
Now you’ve created your first commit! You can see that the commit has given
you some output about itself: which branch you committed to (master),
what SHA-1 checksum the commit has (463dc4f), how many files were
changed, and statistics about lines added and removed in the commit. - page 55 of version 2.25 of the PDF file
The underlined statement is a contradiction.
EDIT: I think I found out ... commit only gives the last 7 hex characters (for some stupid reason)
Last edited:
