Lesson 1 โข Beginner
Introduction to Version Control ๐ฟ
Discover why version control exists, how Git tracks every change, and set up your first repository โ the foundation every developer needs.
What You'll Learn in This Lesson
- โข What version control is and why every developer uses it
- โข How Git tracks changes with snapshots (not diffs)
- โข Git's three areas: Working Directory, Staging, Repository
- โข Installing and configuring Git for the first time
- โข Creating your first repository and making your first commit
1๏ธโฃ What is Version Control?
Version control is a system that records changes to files over time. Without it, you end up with folders full of "final_v2_ACTUALLY_FINAL.zip" files. Git is the world's most popular version control system โ created by Linus Torvalds (the creator of Linux) in 2005. It's distributed, meaning every developer has the full project history on their machine.
Try It: Version Control
See why Git beats the 'rename everything' approach
// What is Git? โ Version Control Explained
console.log("=== What is Version Control? ===");
console.log("Version control is a system that tracks changes to files over time.");
console.log("It lets you go back to any previous version, see who changed what,");
console.log("and collaborate with others without overwriting each other's work.");
console.log();
// Simulating a file's version history
console.log("=== A File's History (Like Google Docs) ===");
const history = [
{ version: 1, author:
...2๏ธโฃ Installing & Configuring Git
Git is available on every operating system. After installing, you need to configure your name and email โ these are embedded in every commit you make so your team knows who changed what.
Try It: Installation & Config
Set up Git on your machine and configure your identity
// Installing and Configuring Git
console.log("=== Installing Git ===");
console.log();
console.log("Windows:");
console.log(" Download from: https://git-scm.com/download/win");
console.log(" Or: winget install Git.Git");
console.log();
console.log("macOS:");
console.log(" xcode-select --install");
console.log(" Or: brew install git");
console.log();
console.log("Linux (Ubuntu/Debian):");
console.log(" sudo apt update && sudo apt install git");
console.log();
console.log("Linux (Fedora):");
...3๏ธโฃ Git's Three Areas
Understanding Git's three areas is the key to mastering it. The Working Directory is your actual files. The Staging Area is where you prepare changes for a commit. The Repository is the permanent history. Think of it as: edit โ stage โ commit.
Try It: Three Areas
Watch files move through Working โ Staging โ Repository
// Git Concepts โ The Three Areas
console.log("=== Git's Three Areas ===");
console.log();
console.log(" โโโโโโโโโโโโโโโ git add โโโโโโโโโโโโโโโโ git commit โโโโโโโโโโโโโโ");
console.log(" โ Working โ โโโโโโโโโโ> โ Staging โ โโโโโโโโโโ> โ Repository โ");
console.log(" โ Directory โ โ Area (Index) โ โ (.git) โ");
console.log(" โโโโโโโโโโโโโโโ <โโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ");
console.log(" git r
...4๏ธโฃ Your First Repository
Use git init to create a new repository, git add to stage files, and git commit to save a snapshot. Use git status constantly โ it tells you exactly what's happening.
Try It: First Repository
Create a repo, add files, and make your first commit
// Creating Your First Repository
console.log("=== git init โ Start a New Project ===");
console.log();
console.log(" $ mkdir my-project");
console.log(" $ cd my-project");
console.log(" $ git init");
console.log(" Initialized empty Git repository in /my-project/.git/");
console.log();
console.log("=== What git init Creates ===");
console.log(" my-project/");
console.log(" โโโ .git/ โ Hidden folder (the repository!)");
console.log(" โโโ HEAD โ Points to current b
...โ ๏ธ Common Mistakes
git add โ Modified files aren't committed until you stage them first. Always git add before git commit.git config --global.git status after every command when learning. It's the best way to understand what Git is doing.๐ Quick Reference โ Essential Git Commands
| Command | What It Does |
|---|---|
| git init | Create a new repository |
| git status | See what's changed |
| git add file | Stage a file for commit |
| git commit -m "msg" | Save a snapshot |
| git log --oneline | View commit history |
| git config --global | Set global settings |
๐ Lesson Complete!
You now understand version control and can create your first Git repository. Next, we'll master the daily workflow: clone, add, and commit!
Sign up for free to track which lessons you've completed and get learning reminders.