SHA-1 Hash Generator — Git Commit Hash Format
Quick Answer: Git uses SHA-1 to identify commits, trees, blobs, and tags. A Git commit hash is the SHA-1 of the commit object content (tree, parent, author, committer, message) prefixed with "commit [size]\0". Git is transitioning to SHA-256 for future security.
FAQ
How does Git compute a commit hash?
Git hashes "commit [byte-size]\0[content]" where content includes the tree hash, parent hash, author, committer, and message. This is why rebasing changes the hash.
Is SHA-1 still secure for Git?
SHA-1 has theoretical collision attacks (SHAttered, 2017). Git uses a hardened SHA-1 that detects known attacks. Git is also adding SHA-256 support as an alternative.