Git & GitHub — Why Version Control Exists
Lesson opener
In one line: What problem Git solves (and why final_v3_REAL.xlsx is not a strategy).
Why it matters: This shows up at work when you need to what problem Git solves (and why final_v3_REAL.xlsx is not a strategy).
Before this lesson: None - if you can save a file, you can learn Git
Before you start
| Resource | Link |
|---|---|
| Previous | Git & workflow (Setup) |
| Next | Install Git & first repo |
| Prerequisites | None — if you can save a file, you can learn Git |
| Time | ~40 minutes |
| What you need | A computer (Windows, Mac, or Linux) |
Quick install only? Setup: Git & workflow is a 15-minute shortcut. This course goes start to finish — local Git, GitHub, teams, deployment, and 2026 workflows.
What you will learn
- What problem Git solves (and why
final_v3_REAL.xlsxis not a strategy) - Git vs GitHub — local tool vs cloud hosting
- The three areas of Git: working directory, staging, repository
- Mental model every professional uses before typing commands
Section 1 — The honest framing
Plain English:
If you only ever work alone on one laptop, you might think: "I'll just copy folders." That breaks the moment you:
- Need yesterday's version of a file
- Work with someone else on the same project
- Deploy a website or app and need a known good snapshot
- Accidentally delete something important
Git is a time machine for your project folder. Each commit is a labeled snapshot you can return to.
GitHub is a website that stores copies of Git repos online — backup, sharing, code review, and automation.
| Saving files manually | Git | |
|---|---|---|
| History | Folder names like backup_old | git log — full timeline |
| Undo | Hope you kept a copy | git restore / checkout a commit |
| Collaboration | Email ZIP files | Push/pull same repo |
| Deployment | "Which folder was live?" | Tag a release, CI deploys that commit |
Section 2 — Git vs GitHub (do not confuse them)
- Git works offline on your machine
- GitHub needs internet — but you can commit locally without it
- Alternatives to GitHub exist (GitLab, Bitbucket) — Git commands are the same
Section 3 — The three-tree model
Every change flows through three states:
- Working directory — files you edit (like any folder)
- Staging area (
git add) — "include these in the next snapshot" - Repository (
git commit) — permanent snapshot in history
Why staging? You can commit part of your changes while keeping other edits unfinished — essential on real teams.
Section 4 — Who uses this in 2026?
| Role | Typical Git use |
|---|---|
| Web developer | Feature branches, pull requests, deploy from main |
| Data analyst | Version SQL scripts and notebooks |
| Mobile (React Native) | Same repo for Android + iOS — you already used Git in android8 |
| DevOps | GitHub Actions run tests on every push |
| Solo learner | Backup + portfolio on GitHub |
Every course on this site — Python, SQL, Power BI exports — benefits from Git discipline.
Section 5 — What you will not learn by guessing
s:**
- Thinking GitHub is Git (it's hosting, not the tool)
- Committing passwords or API keys (stores reject apps; employers fire people)
- Giant commits with 50 unrelated files (use small, logical commits)
- Panic when you see a merge conflict (it's normal — git4 teaches the fix)
Practice
Do this now (no install yet): List three files in a project you'd want to "time travel" back to. Write one sentence describing what a good commit message would say for each.
Example: "Add Q3 pivot table — fixes #12 wrong region totals"
Checklist
- [ ] I can explain Git vs GitHub in one sentence each
- [ ] I know the three states: working → staging → commit
- [ ] I understand why manual
final_v2folders fail
Teacher walkthrough: replace final_v3 folders
All figures illustrative.
Step 1 — Name the pain. List three times folder copies failed (lost edits, wrong deploy, cannot compare).
Step 2 — Map to Git. Each pain → commit history, branch, or push backup.
Step 3 — Three trees. Edit in working dir → git add stage → git commit snapshot.
Step 4 — Git vs GitHub. Local commits work offline; GitHub is remote hosting/review.
Failure example: emailed ZIP as source of truth
Symptom: Two analysts overwrote each other's pivot; nobody knew whose file was live.
Diagnosis: No shared history; filenames lied (FINAL_REAL).
Correction: One repo; small commits; PR or paired review for shared files.
Validation: git log shows who changed the pivot and when.
Guided practice
Is GitHub required to make a commit? One sentence.
Complete solution: No — Git commits locally; GitHub is optional remote hosting until you need backup/collaboration.
Independent practice
Acceptance criteria:
- Git vs GitHub in one sentence each.
- Three-tree flow described with an example file.
- Three files you would version in a real project + sample commit messages.
- One secret you must never commit.
Common mistakes
- Equating GitHub with Git.
- Giant unrelated commits.
- Committing
.env/ keys.
What's next
Install Git & your first repo — install, git init, first commit, and .gitignore.