Let's imagine you're creating a beautiful painting. Once you finish, you want to ensure that no one can alter your artwork without it being evident that a change has been made.
You decide to use a special technique to protect your painting, similar to how Git protects digital data.
1️⃣ Creating a unique signature for your painting:
✔️ Like a painter might sign their name on a canvas, Git creates a signature for every piece of work (called a commit) using a SHA-1 hash. This is not just any signature but a very complex and unique one, derived from everything about your painting: the colors, the brush strokes, the exact arrangement of elements, etc.
✔️ Git takes the data from your files and some additional information (like dates and comments) and processes it through a mathematical function, which outputs a long string of numbers and letters. This string is unique if even a tiny detail in the painting (or file) changes, the resulting signature will be drastically different.
2️⃣ Sealing the painting:
✔️ Imagine now that you place your painting in a transparent, tamper-proof seal. Anyone can see it, but no one can alter it without breaking the seal.
✔️ In Git, once you make a commit and it's signed with its unique SHA-1 hash, this commit is added to the Git repository. The repository is like a gallery where all versions of your projects are displayed orderly, each with its protective seal.
3️⃣ Checking for tampering:
✔️ If someone were to try and repaint a corner of your sealed painting, the seal would visibly break. Similarly, if someone tries to change any part of a commit in Git, the SHA-1 hash (the signature) would no longer match the data in the commit. This is because the hash is recalculated every time someone retrieves the commit to work on or view it, and any discrepancy between the expected hash and the recalculated hash signals tampering.
✔️ This constant checking ensures the integrity of the data. If the hashes match, you can be confident the data is exactly as it was when originally committed; if not, Git alerts you that something has been altered.
4️⃣ Maintaining a clear history:
Just as an art exhibit might show the progression of a painter's style over time through different paintings, Git maintains a clear, unalterable history of changes made during software development. This makes it easy to see who made what changes and when adding another layer of security and accountability.
🏁 This method ensures that every piece of data is protected just like a valuable painting in a gallery, with its unique, unforgeable signature that immediately makes unauthorized alterations obvious.
📚 If you're interested in more in-depth explanation of these topics, please check out my new book "Cracking the DevOps Interview" https://pratimuniyal.gumroad.com/l/cracking-the-devops-interview
📚 To learn more about AWS, check out my book "AWS for System Administrators" https://www.amazon.com/AWS-System-Administrators-automate-infrastructure/dp/1800201532
Top comments (0)