1. main — your clean copy; nobody breaks it
Oliver sets a mug on the edge of the table, pulls a chair closer — you can see the topic makes him happy; it feels familiar.
— Look, — he begins. — Version control, this git of yours, is not some scary pile of commands. It is a system with one job: so that you can go back. Everything I am going to tell you is about that one thing. About reversibility. Remember four words, and the whole picture will fall into place in your head. We old-timers spent half our lives on this — so listen to someone who knows.
— Go on, Uncle Oliver.
— The first word is main. The main line of the project. It is your actual working state — the thing that works and that you show people. Your portal, which you were careful with today. The main rule about main is simple: it must not be broken. This is the clean copy you hand in.
Oliver pulls an image from his own life:
— Remember my thesis? I had a final version — the one you take to the defense. You do not experiment with it, do not try “what if this is better.” You guard it like the apple of your eye. That is what main is: your clean copy. The original project that goes to the client.
Tommy nods. It matches the portal exactly: there it is, working, and it is scary to touch. That is main.
2. Branch — a sandbox where you can break things
— Wait, — Tommy immediately spots the contradiction. — If main cannot be broken, and I need to get into reward-flow — then where? I cannot avoid touching the working version if the task is precisely in the working part.
— And that is where the second word comes in — branch. — Oliver had clearly been waiting for the question. — A branch is an isolated copy-sandbox for a specific task. You create a branch and work in it however you want — break it, try things, rewrite it. And main stays off to the side the whole time, untouched, and waiting.
He goes back to the thesis:
— Want to rewrite a chapter from scratch, but what if it turns out worse? What does a smart person do? Takes a draft copy and experiments in it. Does not touch the clean copy. If it turns out well, the change is moved into the clean copy. If it turns out badly, the draft is thrown out to hell, and that is it — the clean copy stays exactly where it was. Not a scratch.
And then Tommy recognizes the answer to Alex’s recent question in this:
— So that is my “I throw out the failed attempt whole”! I do not clean up the run — I just throw away the draft branch together with all the junk, and main does not even notice I tried anything there.
— You figured it out yourself, rookie. — Oliver smirks. — That is protection. A failed attempt is thrown out together with the branch, and main stays clean. You can let your electronic thing cook up any nonsense in the branch — the working version will not be affected.
3. Commit — an honest return point on disk
— Okay, a branch, — Tommy nods. — But this “return point” I fall back to — what exactly is it?
— The third word is commit. — Oliver does not rush. — While you work in a branch, you periodically record the state — you make a commit. A commit is an honest return point written into the project history. You can return to any commit later.
— Is that like /rewind? Also a rollback?
— Do not mix them up here; this is important. — Oliver raises a finger. — Your /rewind lives in the conversation memory with the agent. The session ends — there is nothing to rewind, the conversation is forgotten. A commit lives on disk, in the project history. Forever. The session ends, the laptop sleeps, the agent forgets everything — but the commit sits there and waits. That is why it is more reliable than any undo button. What actually crashed your night? The button could not reach it because the changes were on disk. And a commit is on disk itself.
Tommy nods slowly. There it is. That line from the night log — “not a single return point” — stops being a technical detail right before his eyes. The agent did not make a single commit all night. Not a single honest mark of “it was still intact here” on disk. So there was nowhere to fall back to — not a single point behind him.
— Like a stamp with a date on blueprints, — Oliver offers an image from his own life. — “Revision three, everything matches.” It sits in the project history, and you can return to it at any moment. That is what a commit is.
4. Rollback and diff — putting the model together
— And the last word is rollback. — Oliver ties the ends together. — If things go sideways in a branch, you return it to the last clean point — to a good commit — with a single operation. Everything extra that was added after that gets erased. You mess up a draft with changes — roll it back to the last good save, and continue from there.
— So, “break it — roll it back — as if it never happened,” — Tommy formulates it himself. — Not “break it — then spend two hours digging it out by hand.”
— Exactly. And alongside rollback there is another word without which the whole defense is full of holes: diff. A view of changes. Rollback saves you after the agent has already made a mess. Diff works earlier — before you accept the change. Before you let changes into the project, you look at what exactly is changing: what was added, what was removed. It is the filter between “the agent suggested it” and “it got into the code.” The very “I will take a look first at what was changed” that you wrote down on the form. Rollback is the safety net below, diff is the filter at the entrance; you need both.
Oliver draws his finger across the table as if sketching:
main ●────●────● ← valuable working line (protect it)
└── fix-reward ●──● ← branch sandbox (experiments)
commits = return points
← rollback returns the branch to a clean point
— That is the whole model. main lives its own clean life. Under it — a branch where you try things. In the branch — commit points. If something goes wrong — rollback to the point, main does not even flinch.
Tommy looks at the imaginary diagram and sums it up himself:
— Listen, so this is just my folder zoo, only in human terms. portal, portal2, portal-final2 — I was trying to make these very return points by hand. Just clumsily: which folder is the real one, a day later you no longer remember.
— There! — Oliver actually comes alive. — Those folders were your homemade, leaky history of states. Exactly like my thesis with final_ispr2. git does the same thing, only honestly and in one place. No final-exact-3. One line, marked points on it, and it is always clear where you are and where to roll back to.
— And the commands? — Tommy reaches for a notebook. — There are probably tons of them. Show me; I will write them down.
— Oh, commands are a separate conversation, — Oliver cracks his knuckles. — You are right to grab a pen. I will show you how it is really done, by hand. The way they taught me.