Vibe Coder's Survival Kit
Module 1: The Fundamentals You Actually Need
1.6 Git Basics

1.6 Git Basics

Time: ~25 minutes

What You'll Learn

  • Why you keep losing work (and how to stop)
  • What Git is and why every developer uses it
  • The save points model for understanding Git
  • The essential commands you'll actually use

Why You Keep Losing Work

If you've ever:

  • Made a change that broke everything and couldn't undo it
  • Had a working version yesterday but can't get back to it
  • Accidentally deleted a file and lost hours of work
  • Wanted to try something risky but were afraid of breaking what works

Then you need version control. This is the problem Git solves.

The Save Points Model

Think of Git like save points in a video game.

Without Git, you have one save file. If something goes wrong, you're stuck. With Git, you create save points as you go. Something breaks? Load an earlier save point. Want to try a risky experiment? Create a save point first.

That's it. That's fundamentally what Git does.

Git is not GitHub. Git is the tool that creates save points. GitHub is a website where you can store your save points online and share them with others. You can use Git without GitHub.

The Three Essential Concepts

1. Repository (repo)

A repository is your project folder with Git tracking enabled. It remembers every save point you've ever made.

# Turn any folder into a Git repository
git init

2. Commit (save point)

A commit is a save point. It captures the state of all your files at that moment.

# Create a save point
git add .
git commit -m "Added user login page"

3. Branch (parallel timeline)

A branch lets you try something without affecting your main save file. If it works, you merge it in. If it doesn't, you delete the branch and nothing is lost.

# Create a new branch to try something
git checkout -b experiment-new-design
 
# If it works, merge it into main
git checkout main
git merge experiment-new-design
 
# If it doesn't, just delete it
git branch -d experiment-new-design

The Five Commands You'll Actually Use

You don't need to know dozens of Git commands. These five cover 90% of what you'll do:

git status -- What changed?

Shows which files have been modified, added, or deleted since your last save point.

git status

git add -- Stage your changes

Tells Git which changes you want to include in the next save point.

# Stage specific files
git add src/components/Header.tsx
 
# Stage everything
git add .

git commit -- Create a save point

Creates the actual save point with a message describing what you did.

git commit -m "Fixed header navigation bug"

git log -- View your save points

Shows the history of all your save points.

git log --oneline

git diff -- What exactly changed?

Shows the exact lines that changed since your last save point.

git diff

The Vibe Coder Workflow

Here's the workflow that will save you from losing work:

  1. Before you start working: Make sure your current state is saved
  2. After each feature or fix: Create a save point with a clear message
  3. Before trying something risky: Create a new branch
  4. If things go wrong: Go back to your last save point
# Start of session - check what's going on
git status
 
# After finishing a feature
git add .
git commit -m "Added contact form with email validation"
 
# Before trying something risky
git checkout -b try-new-layout
 
# If it didn't work out, go back
git checkout main
⚠️

Common vibe coder mistake: Not committing often enough. If you work for 3 hours without a single commit, you could lose 3 hours of work. Commit after every meaningful change.

Writing Good Commit Messages

Your future self (and your AI) will thank you for good commit messages.

Good messages:

  • "Added user login page with form validation"
  • "Fixed bug where profile image wasn't loading"
  • "Moved API calls from component to lib directory"

Bad messages:

  • "Fixed stuff"
  • "asdf"
  • "WIP"
  • "changes"

A good commit message answers: "What did this change and why?"

GitHub: Backing Up Online

Once you're comfortable with local Git, push your save points to GitHub for backup:

# Connect your local repo to GitHub (one time)
git remote add origin https://github.com/you/your-project.git
 
# Push your save points to GitHub
git push origin main

Now if your computer dies, your work is safe online.

Practice

  1. Create a new folder and initialize it with git init
  2. Create a file, add some content, and make your first commit
  3. Make a change and check git status to see what changed
  4. Create another commit
  5. Run git log --oneline to see your save point history

Key Takeaways

  • Git is a save point system for your code
  • Commit early, commit often -- every meaningful change gets a save point
  • Use branches for risky experiments
  • Five commands cover 90% of what you need: status, add, commit, log, diff
  • Push to GitHub for online backup

Module 1 Complete

Congratulations -- you now have the fundamentals you actually need. You understand how the web works, how to organize projects, how to read errors, how APIs work, and how to never lose your work again.

In Module 2, we'll put it all together with vibe coding best practices -- the workflow habits that turn these fundamentals into shipped projects.

Continue to Module 2: Vibe Coding Best Practices


MIT 2026 © Nextra.