Lesson 13: Intro to Git and Version Control
🔧 Lesson 13: Git & Version Control
Version Control system VCS is a tool That tracks changes to your code over time, it does the following:
- Saves every version of your files
- Lets you go back to older versions if you mess something up
- Makes it easy for multiple people to work on same project without stepping on eachother's toes
Git is a version control system — it lets you track every change in your project like a time machine for code. With Git, you can:
- Undo mistakes easily
- Work with others without overwriting each other’s work
- Experiment safely with new features
1. Initialize a Git Repo
Every project needs to be “Git-enabled” before version control can begin. Navigate into your project folder and run:
git init
This creates a hidden .git folder which tracks your changes.
2. Stage & Commit Your Work
You stage files with git add, then save a snapshot with git commit.
git add . # Stages all changes
git commit -m "Initial commit"
Think of commits as “save points” with a label attached. Don’t be lazy — write meaningful commit messages!
3. Check Project Status
Stay informed on what’s happening inside your repo using:
git status # shows staged & unstaged files
git log # shows your commit history
git diff # shows file differences (before staging)
🧠 Bonus Tips
- Only commit working code — don’t break your project history
- Use branches for features (e.g.
git checkout -b feature/signup) - Always
git pullbeforegit pushwhen collaborating
✅ Recap
- Git tracks and saves every change in your codebase
- Initialize with
git init - Stage with
git addand commit withgit commit - Use commands like
git status,git logto navigate project history
Git might seem like overkill when you're solo, but it’s your future best friend when working in teams or revisiting your own code after months.