Hoppa till innehåll
spinout.
Podcast/Avsnitt/Transkript
Transkript

EP03: Hur fungerar Git?

24 mars 2026/18 min
← Tillbaka till avsnittetLyssna på Spotify →

## Introduction

[A] "Imagine you are working on a crucial document, like you know the exact one."

[B] "Oh, absolutely."

[A] "The project proposal, or maybe this massive code base you've been pouring your soul into for like three weeks straight."

[B] "Yeah, you're totally exhausted at that point."

[A] "Right. You are tired, you're rushed, and in this momentary lapse of concentration, your finger just slips."

[B] "The worst feeling."

[A] "You accidentally delete a massive chunk of the file, and then before your conscious brain even registers what happened, muscle memory kicks in."

[B] "You hit save."

[A] "You hit save, and you frantically look for an undo button, you check the system, but there is no version history."

[B] "It is just gone, like vaporized into the digital ether."

[A] "It is a genuinely terrifying feeling. I mean, it's a very specific modern kind of dread where your stomach just drops right out of you because you know the next three days of your life are spoken for."

[B] "Cure panic."

[A] "*Yeah.*"

[B] "But I want you to take that anxiety, that horrible pit in your stomach, and amplify it. Imagine it's not just you."

[A] "Oh, boy."

[B] "Imagine there are five, ten, maybe 50 people editing that exact same application simultaneously."

[A] "Yeah, that's a nightmare."

[B] "Someone is deleting a core function while someone else is like rewriting the interface. Someone is changing the database schema, and you are all just overwriting each other's work in real time."

[A] "It's pure, unadulterated chaos."

[B] "Which is a mathematical certainty in modern software development if you don't have a rigid system in place."

[A] "I mean, you're describing a massive collision of parallel efforts."

## Decoding the Source Material

[B] "Okay, let's unpack this. Our mission today is to decode a really fascinating piece from March 2026. It was published by Spinout and written by Stefan Sånnell."

[A] "Right, the article called How Does Git Work?"

[B] "*Exactly.*"

[A] "But we aren't just here to read a manual. I mean, you probably already know that Git is the industry standard version control system, you know, the tool that stops that exact multi-person chaos from happening."

[B] "Right, it's the safety net."

[A] "But what makes Sånnell's piece so compelling right now is the pivot it makes at the end. We are looking at how the fundamental underlying mechanics of Git, the repositories, the commits, the branches, are suddenly being abstracted away."

[B] "Yeah, completely invisible."

[A] "Made totally invisible by AI."

[B] "And that is the real tension here. We're transitioning from a paradigm where developers had to, like, intimately understand the underlying architecture of their version control to a world where they just declare their intent in plain English."

[A] "Which sounds great, right?"

[B] "*It does.*"

[A] "But to truly understand the magnitude of that shift, and honestly, the architectural risks of letting AI take the wheel, we have to look at the engine itself. We have to look at how Git structurally manages time and space."

## The Repository

[B] "Okay, let's get under the hood then. The article starts with the foundational element, which is the repository or the repo."

[A] "*Right.*"

[B] "A lot of people visualize a repo as just a heavily guarded folder somewhere on a server."

[A] "*Yeah.*"

[B] "But mechanically, when you open your terminal and type git init in a directory, what is actually happening?"

[A] "Well, it's not just creating a folder. When you run git init or, you know, when you pull an existing project down with git clone followed by a URL, git actually creates a hidden directory."

[B] "Hidden?"

[A] "Yeah, it's called .git, and it lives right inside your project. That hidden directory is the actual database. It's basically a surveillance apparatus."

[B] "Oh, wow. So it's watching everything."

[A] "*Exactly.* From that moment on, git isn't just looking at the files you see. It is mapping a complex mathematical tree of your project's history. It is tracking the exact state of every single file, every modification, every deletion."

[B] "Okay, so it's less of a folder and more of a localized database tracking, like, cryptographic hashes of your work?"

[A] "*Yes.*"

## Commits — The Save Point Analogy

[B] "But here's where it gets really interesting. How do we actually tell that database to remember something?"

[A] "The Spinout piece uses an analogy that I think frames this perfectly."

[B] "The video game one?"

[A] "*Yes.* They describe a commit as a snapshot of your code at a specific point in time, comparing it directly to a save point in a video game."

[B] "It works conceptually so well. I mean, before you walk into a boss battle, or in a developer's case, before you attempt to refactor a massive, fragile piece of legacy code, you lock in your progress."

[A] "*Right.* So you don't lose everything."

[B] "Exactly. You create a baseline you can retreat to if your experiment completely destroys the application."

[A] "I get the concept of the save point, totally. But I want to push back on the mechanics a bit."

[B] "Okay, sure."

[A] "Because in a video game, or even just in a Word document, you just hit a single button to save. But Git forces you to go through this deliberate two-step dance."

[B] "Right, the staging area."

[A] "Yeah, according to the article, you first have to use git add dot to stage your changes, and only then do you use git commit dash m to actually finalize it. Why the friction? Why not just have a single command that scoops everything up and saves it?"

[B] "Because Git is designed for surgical precision, not just like bulk storage. Think about how developers actually work in the real world. You might spend four hours writing code."

[A] "*Okay.*"

[B] "And in that time, you touched maybe seven different files. Maybe three of those files contained a brilliant new feature you were asked to build."

[A] "*Right.*"

[B] "But the other four files, they're full of messy print statements, temporary hacks, and broken experiments you used just to test the feature."

[A] "Oh, I see. You do not want to save the garbage into the official permanent history of the project."

[B] "Ah, so the staging area acts as a filter."

[A] "It's like photography."

[B] "Oh, I like that. How so?"

[A] "If the final commit is snapping the photo, the staging area, the git add command, is where you arrange the subjects, adjust the lighting, and make sure someone isn't blinking. You are carefully curating exactly what goes into the frame."

[B] "That is a much better way to visualize it."

[A] "*Yeah.* Use git add to place only those three clean finished files into the frame. You are staging them."

[B] "Leaving the messy ones out."

[A] "The messy files are left out of the shot entirely. Then you execute step two, which is git commit. You click the shutter. That creates an immutable permanent snapshot of those specific files at that exact millisecond."

[B] "And the article points out that the commit command requires a message, the dash M flag, like git commit dash M and then, quote, add login page."

[A] "You basically have to write on the back of the Polaroid explaining exactly what the photo is."

## The Directed Acyclic Graph

[B] "You have to because a git repository isn't a linear list of files. It is a directed acyclic graph."

[A] "A directed acyclic graph."

[B] "It's a complex web of interconnected snapshots. When you or your team are looking back at the history a year from now, trying to figure out when a specific bug was introduced, you aren't looking at the code directly."

[A] "You're looking at the labels."

[B] "*Right.* You are reading the commit messages. The message is the metadata that makes the time travel actually navigable."

[A] "I see the architectural necessity of that, definitely. But let's be realistic about human nature for a second."

[B] "Oh, I know where this is going."

[A] "If I am four cups of coffee deep at 2 AM, my commit messages are going to degrade. I know they are."

[B] "Oh, everyone's do."

[A] "*Right.* Like, I'll start the week writing, refactored the authentication middleware for improved security, and by Friday night, my commit messages are literally just going to be fixed thing or me just mashing the keyboard."

[B] "Which is a universal developer experience, honestly. But it actively destroys the utility of the system."

[A] "Yeah, I bet."

[B] "If your history is just 50 snapshots labeled stuff and more stuff, you have functionally lost the ability to time travel. You can't roll back to a specific state if you don't know what state the snapshot represents."

## Branches — Parallel Universes

[A] "Okay, so we have the mechanics of personal time travel down. Staging frames the shot. Committing snaps the photo and labels it for the archive."

[B] "*Right.*"

[A] "But this all happens locally, inside that hidden .git directory on my personal machine. How does this solve the multiplayer problem?"

[B] "It doesn't. Not on its own."

[A] "Because if five of us are all taking our own little Polaroid snapshots in our own isolated databases, aren't we still going to collide when we try to put the project together?"

[B] "*Exactly.* Local commits don't solve the multiplayer collision at all. If everyone is hacking away at the same main timeline simultaneously, you get complete gridlock. To solve the collaboration problem, Git uses its most powerful structural feature, branches."

[A] "*Right.* The article calls a branch a parallel version of your code."

[B] "So if we have the stable main timeline of our application and I want to build a highly experimental interactive 3D map feature, I don't build it in the main timeline."

[A] "No, absolutely not."

[B] "I use the command git checkout dash b my feature to spin up a parallel universe."

[A] "*Yes.* Physically, though, what is happening there is brilliant. A lot of people assume that branching copies the entire project."

[B] "I mean, that makes sense."

[A] "*Right.* If you have a 2 gigabyte application, they think a branch duplicates those 2 gigabytes. It doesn't."

[B] "In Git, a branch is literally just a lightweight 41-byte text file containing a pointer."

[A] "Wait, a pointer?"

[B] "Yeah, it just points to your current commit."

[A] "Wait, so when I type dash b to create that new universe, it costs almost zero memory."

[B] "Exactly, zero. It just creates a new sticky note pointing to the current state and says, from here on out, record any new snapshots on this separate path."

[A] "*That's incredible.*"

[B] "And the best part is, you can completely destroy the code in your branch. You can delete core files. You set the whole thing on fire. The main version of the code, which the rest of the team is working on, remains completely isolated and perfectly intact in its own timeline."

[A] "So everyone is operating in their own lightweight, isolated dimensions. That completely eliminates the anxiety of breaking the live product. I can experiment fearlessly."

[B] "*Exactly.* That's the power of branching."

[A] "But eventually, my 3D map is finished and it actually works. I need to bring it back to reality. I type git checkout main to teleport back to the original timeline."

[B] "And then I merge my alternate reality into the primary one."

[A] "Yeah, you merge it."

## GitHub — The Cloud Layer

[B] "But we are still missing the network layer here. Because everything we just discussed, staging, committing, branching, merging, it all happens entirely on your local laptop."

[A] "To actually collaborate, your parallel universe needs to reach your teammates."

[B] "Which brings us to the cloud. The Spinout article shifts from git, the local engine, to GitHub. It defines GitHub simply as where your code lives in the cloud. It is the remote distribution center."

[A] "Yeah, if git is the local database on your machine, GitHub is the centralized master server that holds the ultimate source of truth for the entire team. It acts as the synchronization point."

[B] "And the mechanism for that synchronization relies on the final two core commands, push and pull."

[A] "*Right.* If my branch is finished and merged locally, I need to send my snapshots up to the master server. I use git push origin main. I am taking the commits I made locally and pushing them up to the central repository."

[B] "You're updating the global state."

[A] "And conversely, when you sit down at your desk the next morning, you know your teammates were working late and pushing their own branches to the server."

[B] "*Yeah.*"

[A] "Before you write a single line of code, you type git pull."

[B] "So I am pulling down all the latest snapshots from the central server, updating my local database, so I am working with the most current reality."

[A] "*Exactly.*"

[B] "So looking at the whole board here, we avoid the five-person collision because we pull the latest code, branch off into our own isolated dimensions, curate our saves with staging, lock them in with commits, and then push them back to the server to be cleanly merged."

[A] "The workflow is airtight."

## The AI Paradigm Shift

[B] "It is airtight, yes, but it is also undeniably hostile to newcomers."

[A] "Oh, for sure."

[B] "And this is the pivot the article makes. The workflow requires you to constantly translate your human intent into the machine's rigid syntax. Git init, git clone, git add dot, git commit dash m, git checkout dash b, git push origin main."

[A] "It's a lot to remember. If you forget a dash, if you miss a period, the command fails."

[B] "It's a massive cognitive load. You aren't just thinking about the code you are writing. You are constantly having to actively manage the state of the time machine."

[A] "And that leads us to the paradigm shift."

[B] "Stefan Sånnell introduces an AI tool called Claude Code. The premise is staggering. What if you never actually had to type these bash commands again? What if git became invisible?"

[A] "This is where we cross from manual operation to abstraction. We're talking about utilizing large language models to act as a translation layer between the developer's intent and the git terminal."

[B] "I want to read the exact prompt from the source text because the contrast is wild. Instead of manually checking your status, creating a branch, staging your files, and writing a commit message, you just type a plain English sentence into Claude Code."

[A] "Quote, create a new branch called fix login bug and commit my changes."

[B] "What's fascinating here is how the AI parses that semantic request. It analyzes your working directory to see exactly which files have been modified. It automatically structures the git checkout dash b command to create the branch. It runs the git add command to stage the files, analyzes the actual code changes to generate a coherent descriptive commit message, and executes the git commit."

[A] "It does the entire multi-step dance in the background in milliseconds."

[B] "So it completely solves my 2 AM keyboard smash commit message problem."

[A] "*Exactly.* The AI looks at the code, sees that I changed the authentication middleware, and writes the proper label for me. It standardizes the history."

[B] "It takes a complex, multi-step command line utility and reduces it to conversational intent. The article rightly points out that this makes the mechanics of git nearly invisible. You get all the architectural benefits, the safe parallel universes, the granular time travel, the centralized collaboration, without having to speak the syntax."

[A] "That feels like a massive relief, especially for someone who is stepping into a technical role or managing a massive project, but doesn't have a decade of command line muscle memory."

[B] "Oh, it's huge for learners. It democratizes the process. You can just say, save this and put it on a new branch, and the machine handles the bureaucracy."

## The Hidden Danger of Abstraction

[A] "But, and I have to push back here, because I think there is a hidden danger in this level of abstraction."

[B] "The loss of the mental model."

[A] "*Exactly.* If I don't know that my branch is just a 41-byte pointer, and I don't know that my commit is an immutable snapshot on a directed acyclic graph, and I'm just telling the AI to handle it, what happens when things go wrong?"

[B] "Right, because things will go wrong. Because merge conflicts still happen. Two people edit the exact same line of code in two different parallel universes, and when they try to combine them, the system throws its hands up and says, I don't know which one is right."

[A] "If AI has hidden the entire mechanism from me, I have no idea how to untangle that knot."

[B] "Well, you are touching on a very old debate in software engineering."

[A] "*Yeah.*"

[B] "Abstraction is always a trade-off. We don't write machine code using punch cards anymore, right?"

[A] "*True.*"

[B] "We moved to assembly, then to languages like C, then to high-level languages like Python. Every step up abstracts the hardware away. AI abstracting Git is just the next layer."

[A] "I guess that's one way to look at it."

[B] "Yes, the developer might lose the granular understanding of a pointer or a detached head state, but the argument is that the cognitive energy freed up by not having to manage the Git state can be redirected toward actually solving the core engineering problems."

[A] "I see the historical parallel, I do. But Git isn't just a programming language. It is state management. It is the architectural foundation of the team's entire collaboration."

[B] "*Fair point.*"

[A] "If you abstract the foundation away, you are trusting the AI not just with syntax, but with the integrity of your project's history."

[B] "If Claude Code hallucinates or misinterprets your intent, say, it stages files that contain sensitive API keys because you vaguely said commit everything and you aren't manually verifying the git add step, that is a catastrophic security failure."

[A] "Which is why the transition to these tools isn't entirely frictionless. Even as Claude Code translates intent into action, it still requires the user to understand the concepts of branching and committing, even if they aren't typing the commands."

[B] "You still need to know what you want."

[A] "*Right.* You still have to ask it to create a branch. You still have to tell it to push to the origin. You are acting more as a manager delegating tasks to an assistant rather than a mechanic turning the wrench yourself."

## Wrap-Up

[B] "So the necessity of understanding the source material today doesn't go away."

[A] "*Not at all.*"

[B] "Let's lock this in with a rapid fire breakdown. The baseline concepts are still mandatory knowledge."

[A] "Git is the underlying system, operating locally via the .git hidden directory to track the state of your project."

[B] "Commits are your permanent, immutable snapshots, carefully curated through the staging area to ensure only the right code makes it into the historical record."

[A] "Branches are your zero-cost parallel universes, allowing you to experiment on your own timeline without detonating the main project."

[B] "GitHub is the global distribution center where you push those local parallel universes to sync up with the rest of your team."

[A] "And finally, AI tools like Claude Code are acting as an incredibly powerful translation layer, taking our plain English requests and executing that complex underlying machinery on our behalf."

[B] "It takes the friction out of the collaboration. But it leaves us balancing on an interesting edge. We are gaining unprecedented velocity. The workflow is becoming seamless. But the abstraction is absolute."

[A] "Which leaves you, listening right now, with a serious architectural question to ponder. Whether you are actively coding or just managing systems that rely on these tools, understanding these concepts gives you control over your digital reality."

[B] "But as AI increasingly translates our simple conversational English into these complex underlying commands, as it makes the machinery totally invisible, what happens to our fundamental resilience?"

[A] "When we no longer have to speak the native language of the systems we build upon, do we remain architects, or do we just become passengers hoping the AI knows how to drive?"

[B] "It is something to think about the next time you ask a machine to save your work."

[A] "Thanks for joining us on this deep dive."

← Tillbaka till avsnittetAlla avsnitt