Git Setup — Guides | Better Vibe Coding

Git Setup

What version control is, how to install Git, the commands you'll actually use, and how to connect to GitHub.

⏱ ~15 min
Last updated February 2026

Before you start

Your IDE should be set up (IDE Setup guide). You'll need the terminal inside your IDE.

What is version control?

Version control is a system that tracks every change you make to your project and lets you go back to any previous version at any time.

Think of it like the version history in Google Docs. You write something, and Google saves a snapshot. You change it, and Google saves another snapshot. If you mess something up, you scroll back through the history and restore an earlier version. Nothing is ever truly lost.

Git does the same thing for your entire project — every file, every folder. But unlike Google Docs, Git doesn't save automatically. You decide when to take a snapshot. This gives you control over what gets saved and when, which matters a lot when you're building software.

Why vibe coders need Git

Undo mistakes. You asked AI to make a change and it broke everything? Roll back to the version before the change. Instantly.

Experiment safely. Want to try a risky change? Create a branch (a parallel copy of your project), try the change there, and if it doesn't work, delete the branch. Your original code is untouched.

Back up your work. When you push your code to GitHub (more on that below), it's stored in the cloud. Your laptop could catch fire and your code would still be safe.

Track what changed. When something breaks, Git can show you exactly what changed since the last time things were working. This makes debugging dramatically easier.

Install Git

Mac

Git might already be installed. Open your terminal and type:

Terminal
git --version

If you see a version number, you're done. If you get a prompt to install command line developer tools, click Install and follow the steps. This installs Git along with some other useful tools.

Windows

Go to git-scm.com and download the Windows installer. Run it. The default options are fine for everything — just click Next through the installer.

After installation, open a new terminal in Cursor and verify:

Terminal
git --version

Linux

Terminal (Ubuntu/Debian)
sudo apt update && sudo apt install git
Terminal (Fedora)
sudo dnf install git

Configure Git

After installing, tell Git who you are. This information gets attached to your snapshots so you can see who made each change (important when you collaborate with others, and useful for tracking your own work).

Terminal
git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Use the same email you'll use for GitHub (we'll set that up next).

The commands you'll actually use

Git has dozens of commands. You need about seven. Here they are, in the order you'll use them.

git init

Turns a regular folder into a Git project. You run this once when starting a new project.

Terminal
git init
If AI set up your project, it probably already ran this. You can check by running git status. If you see output (even an error about no commits), Git is already initialized. If you see "not a git repository," run git init.

git status

Shows you what's changed since your last snapshot. Files you've modified, new files you've added, files you've deleted. This is your "what's going on right now" command.

Terminal
git status

git add

Stages files for your next snapshot. Think of it like putting items in a box before sealing it. You're telling Git "include these changes in the next snapshot."

Terminal
git add .

The dot means "everything that's changed." You can also add specific files: git add filename.js.

git commit

Takes the snapshot. This saves all the staged changes with a message describing what you did.

Terminal
git commit -m "Add login page"

The message in quotes should be short and describe what changed. Good messages: "Add user signup form," "Fix broken navigation," "Update homepage layout." Bad messages: "stuff," "changes," "asdfasdf."

The add-commit rhythm. This is the pattern you'll repeat constantly: make changes → git add .git commit -m "description". Make changes, stage them, snapshot. That's 90% of Git.

git log

Shows your history of snapshots. Useful for seeing what you've done and finding a point to go back to.

Terminal
git log --oneline

The --oneline flag shows each commit on a single line so it's easier to scan. Press q to exit the log view.

git push

Uploads your snapshots to GitHub (or another remote host). This is how you back up your work and share it.

Terminal
git push

git pull

Downloads the latest changes from GitHub. Use this if you (or someone else) made changes from another computer.

Terminal
git pull

Connect to GitHub

Git lives on your computer. GitHub is a website that stores your Git projects in the cloud. Think of Git as the save system and GitHub as the cloud storage where your saves get backed up.

1

Create a GitHub account

Go to github.com and sign up. The free account is all you need.

2

Create a new repository

On GitHub, click the + in the top right and select "New repository." Give it a name (usually your project name), keep it private (you can change this later), and click "Create repository."

GitHub will show you a page with setup commands. You'll need the URL it gives you — it looks like https://github.com/yourusername/your-project.git.

3

Connect your local project

In your terminal (inside your project folder), run:

Terminal
git remote add origin https://github.com/yourusername/your-project.git
git push -u origin main

The first command tells Git where your GitHub repository is. The second uploads your commits. You'll only need to do this setup once per project. After that, git push is all you need.

Authentication: The first time you push, GitHub will ask you to sign in. It may open a browser window or ask for a token. Follow the prompts. Cursor and VS Code both have built-in GitHub authentication that makes this smoother — look for a popup offering to sign in to GitHub.

The workflow

Here's the full flow you'll follow for every project:

Start: Create a project folder, run git init, connect to GitHub.

Work: Make changes (or have AI make changes). Periodically run git add . then git commit -m "what I did".

Back up: Run git push to upload to GitHub.

Repeat.

How often should you commit? A good rule of thumb: commit after every meaningful change. Finished a feature? Commit. Fixed a bug? Commit. About to try something risky? Commit first, so you can roll back if it breaks.

You don't need to master branches, merging, or rebasing right now. Those are powerful Git features that matter when you're collaborating with a team. For solo vibe coding, the workflow above — add, commit, push — covers 95% of what you need. Chapter 10 in the book goes deeper if you want to learn more.

Git is set up. 📸

You've got version control, you know the core commands, and your code is backed up on GitHub. Last guide: an overview of the AI coding tools you can use to actually build things. AI Tools Overview →

Wait. Before you go.

Be first to know when we launch — plus get a free chapter right now.

No spam. Ever.