DEV Community


Posted on

explain SHA like im 5

What is SHA and how is it related to git?

Top comments (2)

recursivefaults profile image
Ryan Latta

Git, is a bit like a library in that it remembers everything that happens, and it all has an order to it much like the numbers on books in that library so you can find them quickly.

Those numbers are a SHA hash. That SHA hash is a really fancy bit of math that assigns a nearly unique nickname to represent something. In the library example, it'd be like reading the entire contents of the book and giving it a nickname based purely on its entire contents.

The math in the SHA thing makes it almost guaranteed that it'll never match another one, so you can rely on it being unique and never accidentially pointing you to the wrong one.

So to boil it down. Git is like a libarary that has all your changes in it, and the SHA is like the dewey decimal system to locate a specific book.

pandademic profile image

Thanks! That is such a great way to explain it!