0
0
Gitdevops~5 mins

SHA-1 hashing concept in Git - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is SHA-1 in the context of Git?
SHA-1 is a cryptographic hash function that Git uses to uniquely identify commits, files, and other objects by generating a 40-character hexadecimal string.
Click to reveal answer
beginner
Why does Git use SHA-1 hashes for its objects?
Git uses SHA-1 hashes to ensure data integrity and to quickly check if content has changed by comparing unique hash values instead of the full content.
Click to reveal answer
beginner
How long is a SHA-1 hash string in Git?
A SHA-1 hash string in Git is 40 characters long, consisting of hexadecimal digits (0-9 and a-f).
Click to reveal answer
intermediate
What happens if two different files produce the same SHA-1 hash in Git?
This is called a collision and is extremely rare. Git relies on SHA-1's uniqueness to avoid collisions, ensuring each object is uniquely identified.
Click to reveal answer
beginner
How can you see the SHA-1 hash of the latest commit in a Git repository?
You can run the command git log -1 --format=%H to display the full SHA-1 hash of the latest commit.
Click to reveal answer
What does a SHA-1 hash represent in Git?
AA unique identifier for Git objects
BThe size of a file in bytes
CThe date and time of a commit
DThe username of the committer
How many characters long is a SHA-1 hash string in Git?
A64 characters
B20 characters
C40 characters
D128 characters
Which Git command shows the SHA-1 hash of the latest commit?
Agit show HEAD
Bgit log -1 --format=%H
Cgit status
Dgit diff
Why is SHA-1 hashing important in Git?
ATo compress files
BTo speed up network transfers
CTo encrypt commit messages
DTo uniquely identify and verify data integrity
What is a collision in SHA-1 hashing?
AWhen two different inputs produce the same hash
BWhen a hash is too long
CWhen a commit is lost
DWhen a file is deleted
Explain what SHA-1 hashing is and why Git uses it.
Think about how Git tracks changes and verifies data.
You got /4 concepts.
    Describe how you can find the SHA-1 hash of a commit in Git and what it represents.
    Focus on commands and the purpose of the hash.
    You got /3 concepts.