We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

You're on assignment part 1/2 for this lesson.

Different Hashes

My latest Git commit hash was:

5ba786fcc93e8092831c01e71444b9baa2228a4f

You may have noticed that even though we (you and I) both have the same content in our repositories, we have different commit hashes. While commit hashes are derived from their content changes, there's also some other stuff that affects the end hash. For example:

  • The commit message
  • The author's name and email
  • The date and time
  • Parent (previous) commit hashes

All this to say that hashes are effectively unique in practice. While SHA-1 collisions are possible under contrived conditions, you won't accidentally create two different commits with the same hash, and because they're generated automatically for you, you don't need to worry too much about what goes into them right now.

Note: Hash = SHA

Git uses a cryptographic hash function called SHA-1 to generate commit hashes. We won't go into the details of how SHA-1 works in this course, but it's important to know because you might also hear commit hashes referred to as "SHAs".