开发者

How is the 40 character unique identifier in git generated? why is it unique?

开发者 https://www.devze.com 2023-02-16 11:48 出处:网络
I\'m trying to understand why the 40 character identifier used in git is unique and is it fo开发者_如何转开发olproof.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消