Vibe Coding: build real apps with AI · Episode 26. Every agent run below is real: Claude Code 2.1.322 (model claude-opus-5-5) in print mode (claude -p --permission-mode acceptEdits), on 12 November 2026, in /home/asha/projects/weather-app. In this mode the agent may edit files and run read-only commands such as git status, but needs approval for everything else. Nobody approved, so it never ran the app; we tested everything ourselves. Every terminal block is real output from Git 2.43.0 (some long blocks are shortened with ...).
The project: Asha's weather app, written for this video: a tiny Node.js server (server.js), one page (public/index.html, public/app.js, public/style.css) and sample.json, a saved sample of weather data so the demo works offline. The API key in .env is fake (FAKE-demo-key-0000-not-real). "GitHub" in the push and pull sections is a practice remote on the same computer (a bare repository at ~/projects/github-practice/weather-app.git); with GitHub you use the address GitHub gives you, and the commands are the same.
Sources (read on 12 November 2026): Git documentation, gitignore (last updated in Git 2.55.0) and git-branch (2.56.0); GitHub Docs, About pull requests, Removing sensitive data from a repository and About GitHub Desktop.
The problem: four folders, one working app?
Before every big AI change Asha made a copy of her project folder. After a few weeks:
$ ls -l
Nov 11 23:40 weather-app
Nov 8 21:14 weather-app-copy
Nov 10 23:02 weather-app-final
Nov 11 22:47 weather-app-final-WORKING-2
Something broke last night. Which copy was the last one that worked? diff with -r (recursive: look inside folders) and -q (quiet: only say which files differ) compares two folders:
$ diff -rq weather-app-final weather-app-final-WORKING-2
Files weather-app-final/public/index.html and weather-app-final-WORKING-2/public/index.html differ
Files weather-app-final/public/style.css and weather-app-final-WORKING-2/public/style.css differ
It tells you which files differ, but not what changed inside them, when, who changed them, or why.
Why copies fail
- No record of what changed inside each file.
- No when, no who, no why: "final-WORKING-2" is a name, not an explanation.
- Every copy duplicates the whole project, so you make fewer copies than you should.
What we want is save points with a note on each. That is version control: software that records every version of your files. Git is the most widely used version control system.
Real-life example: a video game's save points
| In a video game | In Git | What it means |
|---|---|---|
| The game world | Repository | Your project + its whole history |
| A save point ("before the boss fight") | Commit | A saved version of every file + a message |
| The list of saves | git log |
Every commit, newest first |
| Load an earlier save | git restore / git revert |
Undo a bad change |
Your first repository
$ git init -b main
Initialized empty Git repository in /home/asha/projects/weather-app/.git/
git init creates a hidden folder, .git, where every save point is stored. -b main names the first branch main (branches are explained below).
$ git status
On branch main
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
.env
package.json
public/
sample.json
server.js
nothing added to commit but untracked files present (use "git add" to track)
git status tells you what is going on right now. Untracked files are files Git can see but is not saving in any commit yet. Notice .env: that's where the app's API key lives.
Saving takes two steps
working folder ──git add──▶ staging area ──git commit──▶ commit (save point)
git add <files>puts files into the staging area: the waiting room for the next commit.git commit -m "message"saves everything in the staging area as one commit, with a message.
git add . means "add everything in this folder". Easy, and dangerous when a secret file is in the folder.
"Please tell me who you are" (real error)
$ git add .
$ git commit -m "Weather app: city, today, 3-day forecast"
Author identity unknown
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address
Every commit records who made it. The fix is in the message itself:
$ git config --global user.name "Asha Verma"
$ git config --global user.email "asha@example.com"
$ git commit -m "Weather app: city, today, 3-day forecast"
[main (root-commit) 3017116] Weather app: city, today, 3-day forecast
7 files changed, 54 insertions(+)
create mode 100644 .env
create mode 100644 package.json
create mode 100644 public/app.js
create mode 100644 public/index.html
create mode 100644 public/style.css
create mode 100644 sample.json
create mode 100644 server.js
--global sets the name and email once for every project on this computer. 3017116 is the start of the commit's hash: a unique ID, like a receipt number. And create mode 100644 .env: the key file is now inside a commit. Nobody noticed.
The server, for reference (it reads the key from .env, never from the code):
// Asha's weather app: a tiny Node server. It reads the API key from .env (never from the code).
const http = require("http");
const fs = require("fs");
const path = require("path");
// read KEY=value lines from .env
const env = {};
for (const line of fs.readFileSync(".env", "utf8").split("\n")) {
const [k, ...v] = line.split("=");
if (k && v.length) env[k.trim()] = v.join("=").trim();
}
// a saved sample so the demo works offline (a real app would call the weather API with env.WEATHER_API_KEY)
const sample = JSON.parse(fs.readFileSync("sample.json", "utf8"));
http.createServer((req, res) => {
if (req.url.startsWith("/api/weather")) {
res.writeHead(200, { "Content-Type": "application/json" });
return res.end(JSON.stringify(sample));
}
const file = path.join(__dirname, "public", req.url === "/" ? "index.html" : req.url);
fs.readFile(file, (err, data) => {
if (err) { res.writeHead(404); return res.end("Not found"); }
res.end(data);
});
}).listen(3000, () => console.log("Weather app on http://localhost:3000"));
The vibe coder's habit: commit before every AI change
- Commit while the app works (your save before the boss fight).
- Ask the AI for one change.
git statusandgit diff: what did it touch?- Test it yourself.
- Good? Commit. Bad?
git restore.
Prompt 1 (real): a °C / °F button
claude -p "Add a button that switches the temperatures between °C and °F." --permission-mode acceptEdits
What the agent did (from its log): it ran git status --short && git ls-files ... (read-only, allowed; the list it printed included .env), rewrote public/app.js, added one line to index.html and one to style.css. Its reply began: "I added a °C/°F toggle button under the current temperature. I haven't tested it: the commands to start the server and check the code needed approval and didn't run."
Reading the diff
$ git status
On branch main
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: public/app.js
modified: public/index.html
modified: public/style.css
$ git diff --stat
public/app.js | 32 +++++++++++++++++++++++++++-----
public/index.html | 1 +
public/style.css | 1 +
3 files changed, 29 insertions(+), 5 deletions(-)
Modified = changed since the last commit. A diff shows the difference between two versions line by line: - lines were removed, + lines were added. Part of the real git diff:
- document.getElementById("now").textContent = `${w.tempC}°C, ${w.condition}`;
+ document.getElementById("now").textContent = `${fmt(w.tempC, 1)}°${unit}, ${w.condition}`;
...
<p id="now">Loading...</p>
+ <button id="unit-toggle" type="button">Show °F</button>
<ul id="days"></ul>
The question to ask for every change: does it belong to my request? Here, yes, and 29 lines for a small request is a good sign.
The new public/app.js after prompt 1:
let weather = null;
let unit = "C";
try { if (localStorage.getItem("unit") === "F") unit = "F"; } catch {}
// convert a Celsius value to the current unit, rounded to `digits` decimals
function fmt(c, digits = 0) {
const v = unit === "F" ? (c * 9) / 5 + 32 : c;
return Number(v.toFixed(digits));
}
function render() {
const w = weather;
document.getElementById("city").textContent = w.city;
document.getElementById("now").textContent = `${fmt(w.tempC, 1)}°${unit}, ${w.condition}`;
document.getElementById("days").innerHTML = w.days
.map((d) => `<li>${d.day}: ${fmt(d.maxC)}° / ${fmt(d.minC)}°</li>`)
.join("");
document.getElementById("unit-toggle").textContent = `Show °${unit === "C" ? "F" : "C"}`;
}
document.getElementById("unit-toggle").addEventListener("click", () => {
unit = unit === "C" ? "F" : "C";
try { localStorage.setItem("unit", unit); } catch {}
if (weather) render();
});
async function load() {
const res = await fetch("/api/weather");
weather = await res.json();
render();
}
load();
Test it yourself (run in the compiler)
// Check the AI's °C → °F maths before you commit it
function toF(c) {
return (c * 9) / 5 + 32;
}
const checks = [
[0, 32], // water freezes
[100, 212], // water boils
[27.4, 81.3], // Jaipur now (rounded to 1 decimal)
];
for (const [c, expected] of checks) {
const f = Number(toF(c).toFixed(1));
console.log(c + "°C ->", f + "°F", f === expected ? "OK" : "WRONG");
}
Output:
0°C -> 32°F OK
100°C -> 212°F OK
27.4°C -> 81.3°F OK
In the browser: 27.4°C, and after one click 81.3°F, with the forecast converted too (Fri 84° / 61°). Then commit:
$ git add public/
$ git commit -m "Add °C/°F toggle (Claude Code, tested by hand)"
[main 8f71f68] Add °C/°F toggle (Claude Code, tested by hand)
3 files changed, 29 insertions(+), 5 deletions(-)
$ git log --oneline
8f71f68 Add °C/°F toggle (Claude Code, tested by hand)
3017116 Weather app: city, today, 3-day forecast
Branches: the rough copy and the fair copy
| At school | In Git |
|---|---|
| Fair copy: neat, the one you submit | The main branch: the version that works |
| Rough copy: try things, cross them out | A branch: a separate line of commits |
| Copy the right answer into the fair copy | Merge: bring a branch's commits into main |
$ git switch -c redesign
Switched to a new branch 'redesign'
$ git branch
main
* redesign
git switch -c creates a branch and moves onto it. The Git docs: "it is easier to use the git switch command with its -c option". git branch lists branches; * marks the one you're on.
Prompt 2 (real): "Redesign the whole page"
claude -p "Redesign the whole page so it looks like a modern weather app: a big card, an icon for the weather, a nicer font and a gradient background." --permission-mode acceptEdits
It rewrote all three files (untested: "I've redesigned the page, but I couldn't run it.") and told us one unrequested change: "the big number is now a whole degree ("27°"). Before it showed one decimal."
$ git diff --stat
public/app.js | 91 ++++++++++++++++++++++++--
public/index.html | 42 ++++++++++--
public/style.css | 190 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
3 files changed, 304 insertions(+), 19 deletions(-)
304 lines added: a big change needs a careful look.
The real AI mistake: Friday's forecast under "Thursday"
The new card said Thursday, November 12 · 27° · High 29° · Low 16°. The forecast underneath: Fri 16° – 29°. Today's "High" and "Low" were Friday's numbers. The AI's reply didn't mention it. The lines responsible:
const first = w.days[0];
...
document.getElementById("high").textContent = first ? `${fmt(first.maxC)}°` : "–";
document.getElementById("low").textContent = first ? `${fmt(first.minC)}°` : "–";
The AI assumed the first forecast day is today. Checking the assumption (run in the compiler):
// The AI's guess: "days[0] is today"
const weather = {
tempC: 27.4,
days: [
{ day: "Fri", maxC: 29, minC: 16 },
{ day: "Sat", maxC: 28, minC: 15 },
],
};
const today = new Date("2026-11-12T10:00:00+05:30");
const todayName = today.toLocaleDateString("en-US", { weekday: "short", timeZone: "Asia/Kolkata" });
console.log("Today is:", todayName);
console.log("days[0] is:", weather.days[0].day);
console.log("Same day?", todayName === weather.days[0].day);
Output:
Today is: Thu
days[0] is: Fri
Same day? false
Prompt 3 (real): the exact bug, one small change
claude -p "Bug in the redesign: the card says Thursday, November 12, but High 29° and Low 16° are Friday's forecast (days[0] in sample.json is Fri, not today). Today's data only has tempC. Remove the High and Low boxes from today's card and keep Humidity. Also show the current temperature with one decimal again, like 27.4°. Change only what's needed for this." --permission-mode acceptEdits
Result: three small edits (fmt(w.tempC, 1); the High/Low lines and boxes removed; the box row changed from 3 columns to 1, which it explained) and 3 files changed, 2 insertions(+), 7 deletions(-). The card now shows 27.4° and Humidity 31%. All of this happened on the redesign branch; main never saw the mistake.
Merge
$ git commit -am "Card: drop High/Low (they were Friday's), one decimal again"
[redesign 4c3a3bf] Card: drop High/Low (they were Friday's), one decimal again
3 files changed, 2 insertions(+), 7 deletions(-)
$ git switch main
Switched to branch 'main'
$ git merge redesign
Updating 8f71f68..4c3a3bf
Fast-forward
public/app.js | 88 +++++++++++++++++++++++--
public/index.html | 40 ++++++++++--
public/style.css | 190 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
3 files changed, 299 insertions(+), 19 deletions(-)
$ git branch -d redesign
Deleted branch redesign (was 4c3a3bf).
git commit -am stages every already-tracked changed file and commits in one step. Fast-forward: main had no new commits of its own, so Git simply moved main forward. git branch -d deletes the branch name; its commits stay in main's history.
.gitignore and secrets
Files that must never be committed: .env (settings and secrets such as an API key, a password that lets your app use a service), node_modules/ (downloaded packages, thousands of files you can download again) and junk like logs. .gitignore is a file listing files and patterns Git should ignore. The Git docs: "A gitignore file specifies intentionally untracked files that Git should ignore."
Prompt 4 (real)
claude -p "I'm about to put this project on GitHub. Add a .gitignore so my .env file with the API key doesn't get uploaded." --permission-mode acceptEdits
This time the agent checked the history (git log --all --oneline -- .env) and caught it: "I added the .gitignore, but on its own it won't keep your key off GitHub. Your .env is already committed: it went in with your first commit (3017116). A .gitignore only affects files git isn't tracking yet. If you push now, the API key gets uploaded anyway." (In prompt 1 the same agent had listed .env among the tracked files and said nothing: it answers the question you ask.)
The .gitignore it wrote:
# Secrets
.env
.env.*
!.env.example
# Dependencies
node_modules/
# Logs
npm-debug.log*
*.log
# OS / editor
.DS_Store
Thumbs.db
.vscode/
.idea/
!.env.example means "but do NOT ignore .env.example": a safe template file with placeholder values that other people can copy.
The obvious fix fails (real, on a practice copy)
$ git add .gitignore
$ git commit -m "Add .gitignore"
[main fac5d3e] Add .gitignore
1 file changed, 17 insertions(+)
create mode 100644 .gitignore
$ git remote add origin /home/asha/projects/github-practice/weather-app.git
$ git push -u origin main
To /home/asha/projects/github-practice/weather-app.git
* [new branch] main -> main
branch 'main' set up to track 'origin/main'.
$ git -C ../github-practice/weather-app.git show main:.env
WEATHER_API_KEY=FAKE-demo-key-0000-not-real
Why: the docs say it directly: "Files already tracked by Git are not affected". Tracked = already inside a commit. "To stop tracking a file that is currently tracked, use git rm --cached" (removes it from Git, keeps it on disk). But the old commits still contain it, so before pushing they must be rewritten (new commits that replace the old ones, without the file). If a key was ever pushed, GitHub's docs: "as a first step you need to revoke and/or rotate that secret": make a new key and switch the old one off.
The second real AI mistake: "your local .env file is kept"
Asha replied "Yes, do steps 1 and 2." The rewrite still needed approval, so the agent printed the commands, with this comment: # Step 2: remove .env from every existing commit (your local .env file is kept). We ran them exactly:
$ FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --index-filter 'git rm --cached --ignore-unmatch .env' -- --all
Rewrite 30171168388b286b497275d68e872effa3cec2b6 (1/4) (0 seconds passed, remaining 0 predicted) rm '.env'
Rewrite 8f71f683093b9361ea7b1d1cbc68f86b56cbc7ce (2/4) (0 seconds passed, remaining 0 predicted) rm '.env'
Rewrite 7710a263045dd7321ceab1dcb6ce41a28e905172 (3/4) (0 seconds passed, remaining 0 predicted) rm '.env'
Rewrite 4c3a3bfa4948a3909841196d719cb765f8584f8a (4/4) (1 seconds passed, remaining 0 predicted) rm '.env'
Ref 'refs/heads/main' was rewritten
$ git add .gitignore
$ git commit -m "Add .gitignore to keep .env out of the repo"
[main ea0cc60] Add .gitignore to keep .env out of the repo
1 file changed, 17 insertions(+)
create mode 100644 .gitignore
$ rm -rf .git/refs/original && git reflog expire --expire=now --all && git gc -q --prune=now
$ git log --all --oneline -- .env
$ ls .env
ls: cannot access '.env': No such file or directory
The history was clean, and the .env file on disk was gone, the opposite of the promise. Why: after rewriting, filter-branch checks out the new main; the new main no longer contains .env, so Git removed it from the folder. Lessons: an AI's promise about a command is not proof (check after every command), and back up secrets before any history surgery.
Asha got a new key from the weather service (a rotated key; fake again here):
$ echo "WEATHER_API_KEY=FAKE-demo-key-1111-new-one" > .env
$ git status
On branch main
nothing to commit, working tree clean
$ git check-ignore -v .env
.gitignore:2:.env .env
git check-ignore -v explains which line of which file makes Git ignore a path.
GitHub: remote, push, pull, clone
| At school | With Git |
|---|---|
| The class register in the staff room | Remote: a copy of the repository on another computer. GitHub is a website that hosts remotes |
| Write your entries in | git push: send your commits to the remote |
| Read others' entries | git pull: get new commits from the remote |
| A new student copies the whole register | git clone: download a full copy, history and all |
$ git remote add origin /home/asha/projects/github-practice/weather-app.git
$ git push -u origin main
To /home/asha/projects/github-practice/weather-app.git
* [new branch] main -> main
branch 'main' set up to track 'origin/main'.
$ git -C ../github-practice/weather-app.git ls-tree --name-only main
.gitignore
package.json
public
sample.json
server.js
origin is the usual nickname for your main remote. -u remembers the link so later a plain git push is enough. No .env on the remote.
Working together (real)
Ravi clones, works on a branch, pushes it:
ravi@laptop:~/projects$ git clone /home/asha/projects/github-practice/weather-app.git
Cloning into 'weather-app'...
done.
ravi@laptop:~/projects/weather-app$ git switch -c add-footer
Switched to a new branch 'add-footer'
ravi@laptop:~/projects/weather-app$ git commit -am "Add a footer that says where the data comes from"
[add-footer d512e42] Add a footer that says where the data comes from
1 file changed, 1 insertion(+)
ravi@laptop:~/projects/weather-app$ git push -u origin add-footer
To /home/asha/projects/github-practice/weather-app.git
* [new branch] add-footer -> add-footer
branch 'add-footer' set up to track 'origin/add-footer'.
Asha fetches, reviews, merges and pushes; Ravi pulls:
$ git fetch
From /home/asha/projects/github-practice/weather-app
* [new branch] add-footer -> origin/add-footer
$ git log --oneline main..origin/add-footer
d512e42 Add a footer that says where the data comes from
$ git diff main origin/add-footer --stat
public/index.html | 1 +
1 file changed, 1 insertion(+)
$ git merge origin/add-footer
Updating ea0cc60..d512e42
Fast-forward
public/index.html | 1 +
1 file changed, 1 insertion(+)
$ git push
To /home/asha/projects/github-practice/weather-app.git
ea0cc60..d512e42 main -> main
ravi@laptop:~/projects/weather-app$ git switch main
ravi@laptop:~/projects/weather-app$ git pull
From /home/asha/projects/github-practice/weather-app
ea0cc60..d512e42 main -> origin/main
Updating ea0cc60..d512e42
Fast-forward
public/index.html | 1 +
1 file changed, 1 insertion(+)
git fetch downloads what's new without changing your files. git pull = fetch + merge.
Pull requests
GitHub Docs: "Pull requests are proposals to merge code changes into a project." and "A pull request is GitHub's key collaboration feature, letting you discuss and review changes before merging them." The flow: push a branch → open a pull request on GitHub → read the diff, leave comments → merge into main. For vibe coders: put each AI change on a branch, open a pull request, and review the diff before it reaches main.
Undo: git restore vs git revert (real, on a practice copy)
$ echo "oops" >> public/app.js
$ git status --short
M public/app.js
$ git restore public/app.js
$ git status --short
$ git revert --no-edit HEAD
[main c0ebe04] Revert "Add a footer that says where the data comes from"
1 file changed, 1 deletion(-)
$ git log --oneline -3
c0ebe04 Revert "Add a footer that says where the data comes from"
d512e42 Add a footer that says where the data comes from
ea0cc60 Add .gitignore to keep .env out of the repo
git restore <file>: throw away uncommitted changes to a file.git revert <commit>: for a committed (maybe pushed) change, make a new commit that does the opposite. History keeps both, so teammates stay in sync. (HEAD= the latest commit.)
GitHub Desktop vs the command line
| GitHub Desktop | Command line |
|---|---|
| "a free, open source application", "available for Windows and macOS" (GitHub Docs) | git status / add / commit / push, works everywhere, servers too |
| Buttons for commit, push, pull; a coloured diff | What AI agents like Claude Code use, and what error messages talk about |
| Good for starting out | Worth learning slowly |
Both use the same Git underneath.
Common mistakes (real)
| Mistake | What you see | Why | Fix |
|---|---|---|---|
| Copying folders as backups | Files ... differ (but what?) |
No history | git init, commit often |
| Committing before configuring | Author identity unknown / fatal: unable to auto-detect email address |
No name/email | git config --global user.name/email |
git add . with a .env |
create mode 100644 .env |
Secret inside a commit | Write .gitignore before the first commit |
Adding .gitignore after committing |
git show main:.env prints the key on the remote |
Tracked files are not affected | git rm --cached, rewrite unpushed history, rotate the key |
| Trusting "your file is kept" | ls: cannot access '.env': No such file or directory |
The rewrite's checkout removed it | Back up first; check after each command |
| Not reading the AI's diff | High/Low showing Friday's numbers | An unrequested assumption | git diff, test, ask for one small change |
Mini project
Put one of your own projects under Git and on GitHub:
git init -b main, write a.gitignore(at least.env,node_modules/), thengit statusand check no secret is listed.- First commit. Then ask an AI for one change on a branch (
git switch -c <name>), readgit diff --statandgit diff, test, commit. - Create an empty repository on GitHub,
git remote add origin <its URL>,git push -u origin main, push your branch and open a pull request. Read the diff on GitHub, then merge.
Practice questions
- What is the difference between an untracked file and a modified file?
Answer
An untracked file has never been in any commit; Git sees it but does not save it. A modified file is tracked (it is in a commit) and has changed since the last commit.
- You asked the AI for a button and
git diff --statshows 9 files changed. What do you do?
Answer
Read the diff before anything else. Check each file belongs to the request; throw away unrelated changes with git restore <file> (or all of it, and re-prompt with "change only what's needed").
- Why did
git merge redesignsay "Fast-forward"?
Answer
main had no new commits since the branch was created, so Git just moved main forward to the branch's latest commit; no merge commit was needed.
- Your
.envwas pushed to GitHub last week. List the steps.
Answer
Revoke/rotate the key first (make a new one, switch the old one off). Then stop tracking it (git rm --cached .env), add it to .gitignore, commit. Rewriting history is optional once the key is useless, and copies may already exist elsewhere.
- When do you use
git restoreand whengit revert?
Answer
restore for changes not yet committed; revert for committed changes, especially pushed ones, because it adds a new commit instead of erasing history.
Quiz
Your .env was committed last week. You add it to .gitignore and push. Is the key safe?
A) Yes, .gitignore hides it · B) No: tracked files aren't ignored · C) Yes, if the repo is private · D) Yes, after git pull
Answer
B. Files already tracked by Git are not affected by .gitignore. Stop tracking it, rewrite the history if not pushed, and rotate the key.
Interview questions
- What is a commit, and what does its hash identify? A snapshot of the project plus metadata (author, date, message, parent); the hash uniquely identifies that snapshot.
- Explain the staging area. A list of changes chosen for the next commit, so you can commit some changes and not others.
- Merge vs fast-forward? A fast-forward just moves the branch pointer when there are no diverging commits; otherwise Git creates a merge commit joining two lines of history.
- Why doesn't .gitignore remove a committed file? It only applies to untracked files; tracked files must be removed from the index with
git rm --cached. - How would you review AI-generated changes in a team? On a branch, through a pull request: read the diff, run tests, request small changes, then merge.
Glossary
| Term | Meaning (with an example from this episode) |
|---|---|
| Version control | Software that records every version of your files. Git is one. |
| Git | The most widely used version control system; runs on your computer. |
| Repository (repo) | A project folder plus its whole history (stored in .git). |
git init |
Turns a folder into a repository. |
git status |
Shows what has changed and what is staged right now. |
| Untracked | A file Git sees but has never saved in a commit (.env before the first commit). |
| Tracked | A file that is in at least one commit. |
| Staging area | The waiting room for the next commit; filled with git add. |
| Commit | A save point: a snapshot of the files plus a message, author and date. |
| Commit message | The note on a commit: "Add °C/°F toggle (Claude Code, tested by hand)". |
| Hash | A commit's unique ID, e.g. 3017116. |
git log |
The list of commits, newest first (--oneline = one line each). |
git config |
Sets options such as your name and email (--global = for all projects). |
| Modified | A tracked file changed since the last commit. |
| Diff | The line-by-line difference between two versions (- removed, + added). |
git diff --stat |
A summary of a diff: files and number of lines changed. |
| Branch | A separate line of commits (like a rough copy); main is the main one. |
git switch -c |
Create a branch and move onto it. |
| Merge | Bring one branch's commits into another. |
| Fast-forward | A merge where Git only moves the branch forward (no diverging commits). |
.env file |
A file of settings and secrets (API keys) read by the app, never committed. |
| API key | A secret password that lets your app use a service (and run up your bill). |
.gitignore |
A list of files and patterns Git should not track. |
git rm --cached |
Stop tracking a file but keep it on disk. |
| Rewrite history | Replace commits with new ones (e.g. without .env); changes hashes. |
| Rotate a key | Create a new key and switch the old one off, so a leaked key is useless. |
| Remote | A copy of the repository on another computer (e.g. on GitHub). |
origin |
The usual nickname for your main remote. |
| GitHub | A website that hosts Git remotes and adds pull requests, reviews and more. |
| Push | Send your commits to a remote (git push). |
| Fetch | Download new commits from a remote without changing your files. |
| Pull | Fetch + merge (git pull). |
| Clone | Download a full copy of a repository, history and all. |
| Pull request (PR) | A GitHub page proposing to merge a branch; you review the diff and discuss before merging. |
git restore |
Throw away uncommitted changes to a file. |
git revert |
Make a new commit that undoes an earlier commit. |
HEAD |
The commit you're currently on (usually the latest). |
| GitHub Desktop | GitHub's free, open-source app for Git with buttons instead of commands. |
| Command line / terminal | Typing commands such as git status; what AI agents use. |
Summary
- Folder copies have no history; Git commits are save points with notes.
git addchooses,git commitsaves; setgit configonce.- Commit before every AI change, read
git diff, test, then commit or restore. - Risky AI changes go on a branch; the real redesign showed Friday's forecast as today's, caught in review and fixed with a precise prompt.
.gitignoredoesn't untrack committed files:git rm --cached, rewrite unpushed history, rotate keys. Check what a command really did: the AI's "your .env is kept" was wrong.- Remote, push, pull, clone and pull requests let a class (or a company) work on one project;
restoreandrevertundo anything.
Next episode: Testing AI code: unit tests, Jest and pytest, edge cases, and why green tests can still miss bugs.