ع
Start Topics Teams Reference What's new Saved
Working knowledge

Version control (git)

What is git and why does Claude keep talking about commits?

Short answer

Git is a tool that records every change made to a project so any earlier version can be brought back exactly. It is what makes letting an agent edit your files reasonable — if a change turns out wrong, you restore the last good state in seconds.

The fastest way in is to stop thinking of git as a programmer’s tool and start thinking of it as undo for an entire project. You already know undo for one document, and you know its limits: it covers one file, it only remembers this session, and it’s gone the moment you close the app. Git removes all three limits. It watches every file in a folder at once, it keeps the history permanently, and it lets you jump back to any earlier moment — not the last five keystrokes, but the exact state of everything as it stood on Tuesday afternoon.

The unit of that history is a commit: a save point you create deliberately, with a short note saying what changed. That “deliberately” is the part worth sitting with. Git isn’t autosave. You decide that the work has reached a state worth being able to return to, and you mark it. The note matters as much as the snapshot, because a month later the history reads as an account of why the project looks the way it does — not just a pile of timestamps.

The folder itself, once git is watching it, is called a repository — “repo” in every conversation you’ll ever have about it. This is where the word “project” gets its edges: a repo is a folder with a complete memory of itself. Files you deleted three weeks ago are still recoverable from it. That’s disconcerting the first time you learn it and reassuring every time afterwards.

Here is why any of this appears in a product for non-programmers. When you hand a folder to an agent, you are letting software change many files at once, faster than you can read the results. What makes that a reasonable thing to do is not confidence that the agent is right. It’s that the cost of being wrong is bounded. Commit before you ask for something ambitious, and every possible outcome — brilliant, mediocre, catastrophic — is a few seconds away from being undone. Without that, “let’s see what it does” is a gamble; with it, it’s an experiment. Agentic work is one of the strongest arguments for version control that has ever existed, and it arrived long after git did.

A branch extends the same logic. It’s a parallel line of work: you split off from the main version, change whatever you like, and either fold the result back in or abandon it entirely. The office analogy is making a copy of the shared document so you can wreck it freely — except merging your edits back is a supported operation rather than a nightmare of reconciling two files. For agent work, a branch is the natural container for “try the whole redesign and let me look at it,” because abandoning the attempt costs nothing.

Day to day, you don’t need to memorize commands. Ask in plain language — commit this with a sensible message, what changed since this morning, put that file back the way it was before — and Claude handles the mechanics. What stays yours is the judgment, and it’s real judgment: what deserves a save point, what the note should say so it means something later, when a piece of work should get its own branch, and whether a change you’re about to keep is actually the one you wanted. That last question is reviewing changes, and it’s a separate skill.

The history answers questions the files can’t

The half of git people never reach is that a repository isn’t only files — it’s every version of those files, with a note attached to each change. That history is usually the fastest route to “why is this like this?” and “what broke?”, and you don’t need git log, git blame or git diff to get at it. You ask in the chat and Claude looks:

  • the contact form worked last week and doesn’t now — what changed in server/index.js since then?
  • why does saveMessage read the whole file before writing? When did that get added?
  • who last changed this line, and what were they trying to fix?
  • I haven’t looked at this project in a month. What’s changed since I was last here?

That last one is worth more than it looks when you come back to something you’ve forgotten: instead of opening twenty files at random you get oriented in thirty seconds. (The word blame is git’s, not a judgement — the feature tells you who is responsible for a line, not who is at fault. It is frequently you, six months ago.)

The instinct worth rewiring: when something breaks suddenly, “what changed?” beats “what’s there?” The cause usually isn’t in the file as it stands today, it’s in the difference between today and yesterday — so read the diff, not the code. The one caveat is that history is only as good as the messages people wrote. Claude will reconstruct the story from the diff when a commit says nothing but “fixes”, but it’s a reconstruction, not a record. That’s the practical argument for writing decent commit messages: you’re leaving the explanation your future self will go looking for.

Two honest limits. Git tracks files on disk, so it protects the project folder and nothing else — not the spreadsheet in your shared drive, not your CRM, not anything an agent changed through a connector. And the net only holds what you actually committed; work done since your last commit isn’t in it. Claude Code’s own checkpoints and undo are a useful shorter-lived safety layer inside a session, but they are not a substitute for a commit history you can still read next quarter.

The words

Git
The tool that tracks the history of your code — every change, who made it, and the power to go back. A repository is a project under Git's watch. It's the standard for version control.
Repository repo
A project folder that tracks its own history — "repo" for short. Every saved change is recorded, so you can see what changed, when, and undo any of it. It's a folder with a complete memory.
Commit
A saved snapshot of your code at one moment, with a short note on what changed. Commits line up into a history you can read and rewind. Think of it as a save point in a game.
Branch
A parallel line of work in git — you split off, make changes safely, then merge back when ready, without disturbing the main version. Like editing a copy of a document and folding your edits in later.
GitHub
The most widely used website for hosting git repositories. It holds the shared copy of a project that a team pushes to and pulls from, and adds the collaboration layer around it — pull requests, code review, issues, and automated checks.
Remote origin
The shared copy of a repository that lives somewhere other than your machine — usually on GitHub. Your computer has a full copy of the project; the remote is the copy the whole team syncs against. Its default name is origin.
Push
Sending your local commits up to the remote, so the shared copy has them. The reverse is a pull, which brings other people's commits down to you.
Pull request PR · merge request
A proposal to fold one branch into another, opened on GitHub. It shows the diff, carries a description of what changed and why, and gives reviewers a place to comment — all before anything lands in main.
Merge
Combining the commits from one branch into another — usually folding a finished feature branch into main. When both branches changed the same lines, git can't decide for you and reports a merge conflict, which someone has to resolve by hand.
.gitignore
A file in your project listing what git should never track — .env files, credentials, build output, huge generated folders. Anything matching a line in it stays on your machine and out of every commit.

Read more

Questions people ask

I've been saving with Cmd-S all afternoon. What does a commit give me that saving doesn't?
Saving overwrites — the previous version is gone. A commit freezes the whole project at that moment and keeps every earlier freeze, so you can go back to how things stood on Tuesday rather than just undoing the last few keystrokes. (Getting that history onto a shared copy is a separate step called pushing.)
In one session I fixed a bug, reworded a headline, and my `.env` file changed too. How should I commit that?
Two commits — the bug fix and the reword are separate ideas, and keeping them apart is what keeps your undo precise. The .env should be committed never: it holds a secret, and once a secret is in history, deleting it in a later commit doesn't remove it from the earlier one. Add it to .gitignore, and if it was already pushed, rotate the credential.
Claude edited three files. Two are perfect, one is wrong, and my last commit was before any of it. What's the cleanest way back?
Restore just the wrong file from your last commit — the two good edits stay exactly as they are. Asking Claude to undo the change can work, but it's a reconstruction; restoring from a commit is exact. This is the whole argument for committing before you let an agent loose: it makes 'keep two, discard one' a ten-second operation.
Do I need to learn git commands to work this way?
No. Ask in plain language — commit this with a sensible message, what changed since this morning, put that file back the way it was — and Claude runs the mechanics. What stays yours is judgment: what deserves a save point, what the message should say so it means something in six months, and whether the change you're about to keep is the one you wanted.