DEV Community

Cover image for Git Is Not Magic: Part 1: The Polaroid Analogy
Yash Chavan
Yash Chavan

Posted on • Originally published at hunt092.hashnode.dev

Git Is Not Magic: Part 1: The Polaroid Analogy

Git is something each one of us in today’s world has to learn and well for most, it’s memorizing the command and using them like a type of flow:

add → commit → pull → push

…without understanding what Git actually is, or how it works, which keeps most of us scared of doing anything with Git.

IT DOESNT HAVE TO BE THAT WAY.

Let go on a very simple journey to understand Git, and get you from “Git scared” to “Git confident”, starting from the crux of it.

What is Git?

The technical definition of Git is:

Git is a distributed version control software system

But that’s very vague WHAT DOES IT EVEN MEAN!?

So lets take a step back and understand the technicalities ,

Git as we all know, keep track of our files, and the changes we make to them hence version control system,

But then what thedistributed” part is? ,

That means you don’t just have the latest code, you have the entire history on your own machine.

When you use GitHub, GitLab, or Bitbucket, you’re just syncing your copy of history with someone else’s copy of history.

You are not “sending code to a server”.

You are syncing timelines.

(And fun fact: it doesn’t even have to be GitHub — but that’s a story for another blog.)

Still feels a bit technical, right?

So let’s make it visual.

Taking Polaroids

Imagine we are baking a 3 layered cake, and you want to keep track of each step of the cake.

Every time we finish a step we pull out our Polaroid and click a photo, starting with setting the first base,*click* cutting it as we want,*click* layering it with basic cream, and so forth till we finish the entire cake

Polaroid photo of cake stringed together with thread

With each click, we are seeing the cake getting created out of nothing and we create a timeline for the cake creation.

This is what Git is like, where each photo is the commit we do, and just like the cake following our commits tells us the story of how we created our project from nothing.

Committing History

With every commit we do, we are creating the history of our project [ yes the same one we talked about during the distributed part ] and like the threads of the Polaroid, we can follow this history to find the origin.

Now in our tech world this is now it would look like

commit 0 <- commit 1 <- commit 2 <- present
Enter fullscreen mode Exit fullscreen mode

Doesn’t this look familiar …. that’s right its a linked list, just reversed,

So every commit is like a node, and the arrow is the “next” pointer - except it points to the past and each node holds the snapshot of your code at that point of time.

So your Polaroid album is secretly a linked list.

You don’t need to think of Git like this all the time, but knowing this once removes a lot of fear.

You're Not Scared Anymore, Are You?

Let's recap what we've learned:

Git isn't magic. It's just Polaroids. Each commit is a snapshot of your project at a moment in time, and these snapshots form a linked list pointing backward through history. That's it.

When you do git add and git commit, you're not performing some mystical ritual — you're just taking a photo and adding it to your timeline.

The "distributed" part? That just means everyone has their own complete photo album, their own copy of the entire history. You're not dependent on some server in the cloud. You are the source of truth.

But wait.

If commits are snapshots in time, and they form this chain going backward through history...

Where exactly are YOU in this timeline?

Think about it. You've got this entire chain of commits stretching back to the beginning. But right now, as you're working on your code — which snapshot are you standing on?

And here's the real question: Can you move?

Next time you make a commit, don't think of it as "saving to Git." Think of it as "clicking a Polaroid."

You're building a timeline. You're creating history.

But who's holding the camera?

[Part 2 coming soon]

Top comments (0)