我在 git 中有一个尚未提交的分支,SHA1 0000000000000000000000000000000000000000(全为零),这是正常的还是我损坏了 git 存储库?
请不要回答"is",即 2^160 中有一个,或 0.00000000000000000000000000000000000000000000006842277657836021% 的概率具有该 SHA1。
我相当安全,我不是那个在他的 git 存储库中获得 000000000000000000000000000000000000000 的 SHA1 的幸运儿。
最佳答案
请注意,您可以一直找到“全零 SHA1”到 commit f65fdf (2005 年 6 月 30 日,git v0.99)
Linus Torvalds:
A "old ref" of all zeroes is considered a "don't care" ref, and allows us to say "write the new ref regardless of what the old ref contained (or even if it existed at all)".
This allows (if git-send-pack were to do it) creating new refs, and fixing up old ones.
作为SzG提到in the comments ,这是您在 Git receive/update hooks and new branches 中找到的 SHA1 类型,代表不存在对象的“旧引用”(而“新引用”将创建所述对象,如分支)。
关于git SHA1 0000000000000000000000000000000000000000(全为零),这正常吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18977462/