Which hashing algorithm does Git use to identify commits?

Study for the Architect Journey - Development Lifecycle and Deployment Exam. Enhance your knowledge with quizzes and detailed questions. Prepare effectively for a successful test experience!

Multiple Choice

Which hashing algorithm does Git use to identify commits?

Explanation:
Git creates a unique identifier for each commit by hashing the commit object itself, making the history content-addressable and tamper-evident. The hash function used for that ID is SHA-1, producing a 160-bit digest that appears as 40 hexadecimal characters. This digest is computed from the serialized commit data, including the tree, parent reference, author, date, and commit message, so any change to the commit changes the hash and effectively alters the history linkage. That’s why commits can be reliably tracked and verified as unchanged over time. Other options don’t fit: MD5 is older and has known weaknesses, so it’s not used for Git’s commit IDs; AES is an encryption algorithm, not a hash; SHA-2 refers to newer hash families like SHA-256, which Git does not use for commit IDs in standard practice. (Note: there has been discussion about moving to SHA-256 in the future, but SHA-1 is the convention for commit IDs in typical Git usage.)

Git creates a unique identifier for each commit by hashing the commit object itself, making the history content-addressable and tamper-evident. The hash function used for that ID is SHA-1, producing a 160-bit digest that appears as 40 hexadecimal characters. This digest is computed from the serialized commit data, including the tree, parent reference, author, date, and commit message, so any change to the commit changes the hash and effectively alters the history linkage. That’s why commits can be reliably tracked and verified as unchanged over time.

Other options don’t fit: MD5 is older and has known weaknesses, so it’s not used for Git’s commit IDs; AES is an encryption algorithm, not a hash; SHA-2 refers to newer hash families like SHA-256, which Git does not use for commit IDs in standard practice. (Note: there has been discussion about moving to SHA-256 in the future, but SHA-1 is the convention for commit IDs in typical Git usage.)

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy