Git is a version control system: a tool that saves the state of your project at different points in time, lets you go back, and allows multiple people to work on the same codebase without stepping on each other. Compared to Google Docs or Dropbox, Git does two radically different things: you decide when to save (and you name each save), and each save is a complete state of the project, not an incremental diff.
The mental model: snapshots, not diffs
Many people imagine Git as a series of successive patches. Wrong. Git stores snapshots: at each commit, it keeps a complete photo of the file tree at that moment. Files that have not changed are just references to the previous version (disk savings), but conceptually each commit is a complete, self-contained state.
Practical consequence: you can walk through history like a photo library. Each commit has a unique identifier (a SHA hash, like a3f5b6c), a date, an author, a message, and one parent (except the very first commit). Together they form a graph.
Three zones, three roles
When you work, your project lives in three distinct zones:
- Working directory: the files you see and edit in your editor.
- Staging area (or "index"): a buffer where you prepare your next commit. You can put only some changes there and leave others for later.
- Repository: the history of commits, immutable once written.
The normal flow: you edit a file (working), you run git add fichier.txt (staging), you run git commit -m "..." (repository). This separation is what lets you commit one topic at a time, even if you touched ten files in the meantime.
Local first, remote later
Git is distributed: the entire history of your project is stored on your machine, in the hidden .git/ folder at the root of the project. You can make commits, create branches, browse history, all without a network connection.
Synchronization with a remote server (GitHub, GitLab, etc.) is done explicitly with git push and git pull. You choose when to publish your work, and only then can others see it.
Check your install
You should see a version number (for example git version 2.43.0). If the command is not found, install Git from git-scm.com.
Introduce yourself to Git
Before your first commit, Git wants to know who you are. This config is done once, globally.
This email will appear in your commits. If you publish to GitHub, use the email associated with your GitHub account so your commits are attributed correctly.
What comes next
The next lesson has you create your first repo, your first commit, and gives you the commands you will use every day.
