git SHA1 0000000000000000000000000000000000000000 (all zeroes), is this normal?

ε祈祈猫儿з 提交于 2019-11-30 09:24:02

A commit includes, among other metadata, the commit date. So the commit hash can't be displayed until the commit has actually been created. What you're seeing is not a commit SHA, it's just a default value used in the UI.

VonC

Note, you can find the "all-zeros SHA1" all the way back to commit f65fdf (June 30th, 2005, v0.99 of git)

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.


As SzG mentioned in the comments, this is the kind of SHA1 you find in Git receive/update hooks and new branches, representing an "old-ref" for a non-existent object (while the "new-ref" would create said object, like a branch).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!