Git and GitHub Basics: Version Control Essentials for Vibe Coders
English · 繁中 · Español · 日本語 · Português (BR)
Author: Danko Peng (@dankopeng)
Updated: March 2026
Reading time: ~12 minutes
Why Do You Need Git?
You quickly built a feature with AI and deployed it.
Next day, you discover this feature broke something else. You want to go back to yesterday's version, but you've modified dozens of files, don't know what changed, and don't remember what it looked like before.
Git solves this problem.
Git is a version control tool—it records every "save" state, letting you return to any point in time. It runs on your own computer, works without internet.
GitHub is a cloud platform that lets you back up Git's version history online. Your code has cloud backup, no fear of losing it when switching computers, and others can see your project.
Simply put: Git is the tool, GitHub is the warehouse.
GitHub Core Concepts
Repository (Repo)
A repository is where GitHub stores all code and history for a project. Each project corresponds to one repo.
Your repo can be:
- Public: Anyone can see, suitable for open source projects or educational content
- Private: Only you and invited people can see, suitable for commercial product source code
The vibefast-docs repo is public, anyone can see the tutorial content. vibefast.app template source code is in another private repo, only paying customers can access—this is how many commercial templates are delivered.
Clone
Clone copies a GitHub repo to your local computer:
git clone https://github.com/vibefast-app/vibefast-docs.gitAfter cloning, you have the complete code and history locally.
Fork
Fork copies someone else's repo to your own GitHub account, letting you freely modify your version without affecting the original repo. This is a common open source collaboration method.
Step 1: Install Git and Set Identity
Check if Git is installed
macOS usually has Git built-in:
git --version
# If it outputs a version number, it's installed, e.g.: git version 2.39.3If not, install with Homebrew:
brew install gitSet your identity
Git records who made each commit. Tell Git who you are (only need to do once):
git config --global user.name "Danko Peng"
git config --global user.email "danko@example.com"Email should match your GitHub account so GitHub can link commits to your account.
Create GitHub account
Go to github.com and register, free account is sufficient.
Step 2: Create New Repo on GitHub
- Log into GitHub, click + in top right → New repository
- Fill Repository name (e.g.,
my-app, only English, numbers, hyphens) - Choose Public or Private
- Don't check "Add a README file"—because you already have a local project, let local take precedence
- Click Create repository
GitHub creates an empty repo and shows commands to run next—you'll use these shortly.
Step 3: git init and Connect to GitHub
You have a project folder locally, an empty repo on GitHub, now connect them.
Scenario 1: Local project exists, push to GitHub
# Enter your project folder
cd my-app
# Initialize Git (make this folder tracked by Git)
git init
# Create .gitignore first, exclude files that shouldn't be tracked (explained below)
echo ".env" >> .gitignore
echo "node_modules/" >> .gitignore
# First time add all files and commit
git add .
git commit -m "initial commit"
# Connect to GitHub repo (replace with your username and repo name)
git remote add origin https://github.com/YOUR_USERNAME/my-app.git
# First push to GitHub
git push -u origin maingit remote add origin tells local Git: "My cloud backup is at this GitHub URL, name it origin."
-u origin main only needed for first push, afterwards just git push.
Scenario 2: Project cloned from GitHub
If you cloned from GitHub (like cloning vibefast.app), Git already connected origin automatically, just use:
git add .
git commit -m "my first change"
git pushConfirm connection succeeded
git remote -vOutput should look like:
origin https://github.com/YOUR_USERNAME/my-app.git (fetch)
origin https://github.com/YOUR_USERNAME/my-app.git (push)Step 4: Daily Workflow
After setup, daily development is these three commands:
git add .
git add .Tells Git: "Prepare all files I've modified for saving."
. means "all changes in current directory." To add specific files only:
git add apps/web/app/routes/blog.tsxgit commit -m "update order features"
git commit -m "update order features"The actual save action. -m followed by description of what changed.
Good commit messages let you three months later immediately know what was done:
# ✅ Clear
git commit -m "add reading time display to blog posts"
git commit -m "fix order status not updating after Stripe webhook"
git commit -m "remove unused imports in api/users.ts"
# ❌ Meaningless
git commit -m "update"
git commit -m "fix bug"
git commit -m "asdfgh"git push
git pushSync local commits to GitHub. Your code has cloud backup.
View History
git log --onelineOutput looks like:
a3f2c1d add email notification for new orders
9b8e4a2 fix order status not updating after webhook
3d7f1c5 add reading time to blog posts
1a2b3c4 initial commitEach line is one commit, the string in front is the commit ID. To return to a version:
git checkout 9b8e4a2Important: Things Pushed to GitHub Have History
This is what many don't know, and the easiest way to cause serious problems.
Deleting a file and pushing doesn't mean the file disappeared.
Git is designed to preserve all history. What you deleted can still be found in commit history. Anyone cloning your repo and looking at old commits can see that file's previous contents.
And GitHub has automated programs scanning new pushes 24/7, specifically looking for leaked API keys. From the moment you push, it may have already been scanned.
Most Common Dangerous Scenario
You accidentally committed .env:
git add . # Accidentally included .env
git commit -m "add stripe integration"
git push # Pushed to GitHubThen you noticed, immediately delete and push:
git rm .env
git commit -m "remove .env"
git pushThis doesn't work.
Current commit doesn't have .env, but previous commit still does. Anyone looking at commit history can see your Stripe key, JWT secret, all secrets.
Correct Remedy Steps
Step 1 (most important): Immediately go to corresponding platform to revoke that key and regenerate a new one. Regardless of how you clean git history later, do this first. The key is already leaked, must be considered invalid.
Step 2: Remove from history completely. Use git filter-repo:
# Install
pip install git-filter-repo
# Remove .env from all commit history
git filter-repo --path .env --invert-paths
# Force push to GitHub (overwrite history)
git push --forceBut the best method is never let it enter git in the first place.
Prevention: .gitignore
.gitignore tells Git which files to never track:
# .gitignore
.env
.env.local
.env.production
node_modules/
.wrangler/
dist/Critical sequence: After git init, before first git add ., create .gitignore first.
If you git add . first then create .gitignore, .env might already be tracked, adding to .gitignore later won't help. Order matters.
vibefast.app's .gitignore is already configured, you don't need to manually add. Remember this step when creating new projects yourself.
Glance Before Pushing
# See files prepared for commit
git status
# See specific content changes
git diff --stagedDevelop the habit of glancing at git status before pushing, confirm no unwanted files snuck in.
Danko Peng
X · YouTube · Threads
Ready to skip the setup and start building?
👉 vibefast.app — Early bird $99, price increases to $199 on August 1, 2026.