Git
Never lose your work again
When you build with AI, the AI changes many files at once. Sometimes it makes things better. Sometimes it breaks something that worked five minutes ago. Git is the tool that lets you go back.
What is Git?
Think of a video game with save points. Before a hard boss fight, you save. If you lose, you load the save and try again. You never have to restart the whole game.
Git gives your project save points. Git is a free program that keeps a history of every version of your files.
- You decide when to save a version
- Each save has a short note about what changed
- You can look back at old versions at any time
- You can undo changes that broke your app
Three key ideas
You only need three words to get started:
- Repository (repo): your project folder, with Git watching it. Git keeps its history in a hidden folder inside.
- Commit: one save point. It is a snapshot of all your files at one moment, plus a message.
- History: the list of all your commits, from oldest to newest.
Every save goes through the same small path:
The staging area is like a shopping basket. You put the changes you want in the basket, then you check out with a commit.
What you'll learn
How to use this section
Each page builds on the one before, so I recommend going in order:
- Install Git — set it up once on your computer
- Your first commit — make your first save point
- History and undo — look back and go back safely
You will type a few short commands in the terminal. The terminal is a window where you type instructions to your computer instead of clicking. Don't worry, you only need a handful of commands.
Practice
Try these exercises to lock in what you just learned.
What's next?
Let's get Git onto your computer. Head to Install Git to start.