A time machine for your code
Day 26 of 149
π Full deep-dive with code examples
The Time Machine
Imagine writing an essay and being able to:
- Save a snapshot every few minutes
- Go back to any previous version
- See exactly what changed between versions
- Try something risky and undo if it breaks
Git is a time machine for your code!
How It Works
You make "commits" - snapshots of your code at a moment in time.
Commit 1: "Started project"
Commit 2: "Added login page"
Commit 3: "Fixed bug in login"
Commit 4: "Added dashboard" β You are here
Messed up? Go back to Commit 3!
Key Commands
| Command | What it does |
|---|---|
git init |
Start tracking a project |
git add |
Stage files to save |
git commit |
Save a snapshot |
git log |
See history |
git checkout |
Go back in time |
Branches
Work on features without breaking the main code:
main: ββββββββββ
\
feature: βββββββ
When feature is ready, merge it back!
In One Sentence
Git saves snapshots of your code so you can go back in time, experiment safely, and collaborate with others.
π Enjoying these? Follow for daily ELI5 explanations!
Making complex tech concepts simple, one day at a time.
Top comments (0)