I'm trying to understand why the 40 character identifier used in git is unique and is it fo开发者_如何转开发olproof.
Also what are the various inputs that are used to generate the unique key.
It is an SHA-1 hash of some header information and the commit; see http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#object-details for details of the hashing, and http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#commit-object for the commit object being hashed. It is not guaranteed to be unique (since it is created using a many-to-one mapping), but the probability of a collision are so small as to be practically zero. You should treat the IDs as always unique.
精彩评论