开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜