🦞 4minAI.com
1 / 15
Day 17 of 28 Β· Vibe Coding Challenge

Version Control Essentials

You've been building. But have you been saving? Not just the files β€” but the history of your project. Version control is your undo button, your backup, and your time machine, all in one.

Today you'll learn Git β€” the tool every developer uses, and the tool that will save your vibe coding projects from disaster.

Why you need version control

Picture this: your app works perfectly. You ask the AI to add a new feature. Suddenly everything breaks. The landing page is gone. The database connections are wrong. The whole project is a mess.

Without version control, you're stuck. With version control, you type one command and you're back to the working version. Instantly.

That alone makes Git worth learning.

Knowledge Check
What is the main benefit of version control for vibe coders?
A
It makes the code run faster
B
It's required by AI coding tools
C
It automatically fixes bugs
D
You can undo any change and go back to a previous working version of your project
Version control is your safety net. Every time you save a version (called a "commit"), you create a restore point. No matter how badly things break, you can always go back to a state that worked. That safety net gives you the confidence to experiment freely.

Git in 5 minutes

Git has hundreds of commands. You need about five:

git init β€” Start tracking a project. Run this once in your project folder.

git add . β€” Stage all your changes (tell Git "I want to save these").

git commit -m "message" β€” Save a snapshot with a description. Like naming a save file in a game.

git log β€” See the history of all your saves.

git checkout β€” Go back to a previous save.

That's it. Five commands, and you have a time machine.

Git workflow diagram β€” commit, experiment, rollback if broken, commit again β€” with key commands
Save your wins. Experiment freely. Roll back if needed.
πŸ€–
AI Coding Assistant
online
I just finished building my landing page. How do I save this version with Git?
Three commands: ``` git init git add . git commit -m "Landing page complete with hero, features, pricing" ``` βœ… `git init` β€” Initializes Git in your project (one-time setup) βœ… `git add .` β€” Stages all files βœ… `git commit -m "..."` β€” Saves the snapshot with your description Your landing page is now safely saved. You can always come back to this exact state.
↻ Replay conversation
Knowledge Check
What does `git commit -m "Added pricing section"` do?
A
Saves a snapshot of your project with the description "Added pricing section"
B
Deletes the pricing section
C
Sends the code to your team
D
Uploads the code to the internet
A commit is a save point. The -m flag adds a message describing what changed. Think of it as labeling a save file in a video game β€” "before the boss fight" or "after getting the key." You'll thank yourself later when you need to find a specific version.

The save-before-you-experiment pattern

Here's the vibe coder's Git workflow:

1. Build something that works. Your landing page, your feature, whatever.

2. Commit it. `git add . && git commit -m "Working version of XYZ"`

3. Experiment. Ask the AI to add a big new feature.

4. If it works β†’ commit the new version.

5. If it breaks β†’ revert to the last commit: `git checkout .`

That's it. Save your wins. Experiment freely. Roll back if needed.

πŸ€–
Cursor AI
online
I asked the AI to redesign my dashboard and now everything is broken. The sidebar is gone, the routing doesn't work, and half my components have errors. Can I undo everything?
If you committed before making the changes, absolutely: `git checkout .` This resets all files to the last commit. Your working dashboard is back. If you didn't commit first... the changes may be hard to undo manually. This is why we always commit before big changes.
I didn't commit. Is there any way to recover?
Unfortunately, without a commit, Git has nothing to go back to. We'll need to manually fix the issues. Lesson learned: always `git commit` before asking AI to make major changes. Think of it as quicksaving before a boss fight.
↻ Replay conversation
Knowledge Check
When should you commit your code?
A
Before every major change or experiment β€” especially before asking AI to refactor or add big features
B
Every time you change a single line
C
Once a week
D
Only when the project is completely finished
Commit whenever you have something that works. Before adding a new feature, before refactoring, before any change that could break things. Each commit is a safety net. You can never have too many save points.

GitHub β€” your code in the cloud

Git saves your history locally. GitHub saves it online. This means:

Backup β€” Your code is safe even if your computer dies.

Sharing β€” Other people can see and use your code.

Deployment β€” Services like Vercel deploy directly from GitHub.

Collaboration β€” Teams work on the same codebase through GitHub.

Pushing to GitHub is one command:

```

git push origin main

```

This uploads your commits to your GitHub repository. From there, Vercel auto-deploys, teammates can review, and your code is safely backed up.

Knowledge Check
What's the difference between Git and GitHub?
A
Git is for individuals, GitHub is for teams
B
Git tracks changes locally on your machine; GitHub stores your code online for backup, sharing, and collaboration
C
Git is free, GitHub is paid
D
They're the same thing
Git is the tool that tracks your project's history on your computer. GitHub is the online service that hosts your Git repositories in the cloud. You can use Git without GitHub, but most people use both β€” Git for version tracking, GitHub for backup and collaboration.

Quick reference

Keep this handy:

| What you want to do | Command |

|---|---|

| Start tracking a project | `git init` |

| Save your current state | `git add . && git commit -m "description"` |

| Undo all unsaved changes | `git checkout .` |

| See your save history | `git log --oneline` |

| Upload to GitHub | `git push origin main` |

| Download from GitHub | `git clone <url>` |

Final Check
A vibe coder asks: "I'm about to ask AI to completely rebuild my navigation. What should I do first?"
A
Write down a list of current features
B
Close the project and open a new one
C
Commit the current code β€” so you can roll back if the rebuild goes wrong
D
Take a screenshot of the current design
Always commit before major changes. If the rebuild goes well, commit the new version. If it breaks everything, one command gets you back to the working version. Git makes experimentation risk-free.
πŸ•
Day 17 Complete
"Commit before you experiment. It's the cheapest insurance in software."
Tomorrow β€” Day 18
Working with Existing Code
Not everything starts from scratch. Tomorrow you'll learn to work with existing codebases β€” modifying, extending, and improving code that's already written.
πŸ”₯1
1 day streak!