What is Git actually doing?
Save points in a video game, but for your folder of files.
A commit is a named photograph of your entire project that you can return to at any time, forever.
01The problem git was born to solve
You are working on a project. It reaches a state you do not want to lose, so you copy the folder. A week later you do it again. Soon your desktop holds project, project-old, project-final, project-final-2-REALLY. Every developer on earth has done this. It works — until the day you need to answer one simple question: what exactly changed between these two versions?
With copied folders, answering that means opening files side by side and squinting. Git was built to answer it instantly. The price is one habit: when your work reaches a state worth keeping, you tell git to save it, with a short label describing what it is.
Linus Torvalds wrote git in 2005 in about ten days — for managing the Linux kernel, one of the largest collaborative projects in history. He needed something fast and honest about history. The name is a joke about himself: git is British slang for an unpleasant person.
02Commits are photographs of your project
When you tell git to save, it does not save one file — it photographs everything, all at once. That photograph is called a commit. A commit remembers the exact content of every file in your project at that moment, plus the label you gave it, plus the time, plus who made it.
Think of a video game. Before a hard level you save; if things go wrong you load the save and nothing is lost. A commit is that save point, with two upgrades. First, all your save points are kept forever, in order, as a chain — git calls this chain the history. Second, each one carries a message you wrote, so you can find the exact moment anything happened.
- —a commit — a photograph of every file, at one moment
- —the message — the label you write on the photograph
- —the history — the chain of every photograph, in order
Git does not save changes — it saves complete states. Every commit is a full snapshot of your project. Diffing, restoring, and time travel are all just git comparing photographs.
03Where the photographs live
Git keeps every commit inside one hidden folder named .git, sitting inside your project folder. You will almost never look inside it — it is a packed archive, not meant for humans. What matters is knowing it exists: your entire history lives in your project, travels with your project, and needs no internet.
This is also the precise line between git and GitHub. Git is the tool on your computer; committing is completely offline. Sharing your photographs with the world is a separate, later step — and the website where that happens is GitHub. The last courses of this series cover exactly that split.
git --version
gitTyping git with nothing after it prints git's own summary of its commands. Real git opens a long manual page; this simulator prints a short readable list instead.
Practice
Say hello to git in the terminal.
01.Ask git which version it is.
hint: Try: git --version
02.Ask git for its list of commands (type git with nothing after it).
hint: Try: git