What is Git?
TL;DR — Quick Summary
- Git is a distributed version control system that tracks every change to your code over time.
- Every developer has a complete copy of the project history — no central server dependency.
- Core workflow:
git init→ make changes →git add→git commit. - Git ≠ GitHub. Git is the tool; GitHub is a hosting platform for Git repositories.
Lesson Overview
Git: The Developer's Time Machine
Git is a distributed version control system (DVCS) created by Linus Torvalds in 2005 (yes, the same person who created Linux). At its core, Git does one thing brilliantly: it tracks changes in your files over time, so you can recall any version of your project whenever you need it.
Before Git, developers shared code by emailing zip files or using fragile centralized systems where one bad commit could break everything for the entire team. Git solved all of that.
🏗️ Centralized vs. Distributed
To appreciate Git, you need to understand the two types of version control systems:
- Centralized (e.g., SVN): There is one central server. Every developer commits directly to it. If the server goes down, no one can work. If history is lost, it's gone forever.
- Distributed (Git): Every developer has a complete copy of the entire project history on their local machine. You can work fully offline, and no single point of failure can wipe out your project.
⚡ Why Every Developer Uses Git
- 🔗 Collaboration: Teams of thousands contribute to one codebase without stepping on each other's toes.
- 📜 History: Every change ever made is recorded — who made it, when, and why.
- 🌿 Branching: Experiment freely without breaking the working product.
- 🛡️ Safety: Made a mistake? Roll back to any previous state in seconds.
- 🚀 Speed: Almost all operations are local — no network round trips needed.
Git is not optional in modern development. It is the foundation every professional workflow is built on.
Conceptual Deep Dive
.git folder inside your project. That folder is your entire repository — it contains every version of every file you've ever committed.Implementation Lab
# Step 1: Create a new project folder
mkdir my-project
cd my-project
# Step 2: Initialize Git (creates a hidden .git folder)
git init
# Output: Initialized empty Git repository in /my-project/.git/
# Step 3: Tell Git who you are (one-time global setup)
git config --global user.name "Your Name"Name"
git config --global user.email "you@example.com"
# Step 4: Check the current state of your repo
git status
# Output: On branch main, No commits yet, nothing to commit
# Step 5: Create a file
echo "# My Project"Project" > README.md
# Step 6: Stage the file (prepare it for a snapshot)
git add README.md
# Step 7: Commit — take the snapshot!
git commit -m "Initial commit: add README"README"
# Output: [main (root-commit) a3f8c21] Initial commit: add README# View all Git settings
git config --list
# View just your username
git config user.name
# Set your default editor to VS Code
git config --global core.editor "code --wait"
# Set default branch name to 'main' for new repos
git config --global init.defaultBranch mainPro Tips — Senior Dev Insights
Add git config --global color.ui auto to get coloured terminal output — much easier to read.
Use git config --global alias.st status to create shortcuts. git st is faster than typing git status every time.
Run git log --oneline --graph --all to see a beautiful visual tree of your entire commit history.
Set up a global .gitignore file with git config --global core.excludesfile ~/.gitignore_global to ignore OS junk like .DS_Store everywhere.
Common Developer Pitfalls
git config --global user.name and user.email — your commits will have wrong or missing author info.Confusing Git with GitHub. Git is the tool; GitHub is just one place to store Git repos remotely.
~) instead of your specific project folder — this tries to track your entire computer!.git folder thinking it's unnecessary — you'll lose all your project history.Interview Mastery
Git is the version control software that runs locally on your computer — it tracks changes, manages history, and handles branching/merging. GitHub is a cloud platform that hosts Git repositories online, enabling collaboration, pull requests, and code reviews. You can use Git entirely without GitHub. GitHub is just one of many remote hosting options (GitLab, Bitbucket, etc.).
In a centralized VCS (like SVN), there is a single central server and developers only have the latest version locally. In a distributed VCS (like Git), every developer has a complete clone of the entire repository including all history. This means you can work offline, operations are faster (local), and there is no single point of failure.
The .git folder is the repository itself. It stores: the complete history of all commits, all branches and tags, configuration settings, the staging area index, and Git's internal object database (blobs for file content, trees for directory structure, commit objects, and tag objects). Deleting this folder removes all version history.
Real-World Blueprint
"When NASA's Jet Propulsion Laboratory writes code for Mars rovers, they use Git. When thousands of engineers at Google, Meta, and Microsoft collaborate on a single codebase, they use Git. When you're fixing a bug at 2am and need to see what changed last Tuesday — Git has your back."
Hands-on Lab Exercises
git --version.git config --global.Create a new folder, initialize a Git repo, add a README.md file, and make your first commit.
git log after committing to see your commit in the history.Real-World Practice Scenarios
A junior developer on your team asks: 'Why do we use Git instead of just saving files to Dropbox?' — How do you explain the key differences?
.git folder. What does that mean and what should you do first?You set up Git but your commits show the wrong author name. How do you fix it?
You want to start tracking an existing project that currently has no version control. What are the exact steps?
What is Git?
TL;DR — Quick Summary
- Git is a distributed version control system that tracks every change to your code over time.
- Every developer has a complete copy of the project history — no central server dependency.
- Core workflow:
git init→ make changes →git add→git commit. - Git ≠ GitHub. Git is the tool; GitHub is a hosting platform for Git repositories.
Overview
Git: The Developer's Time Machine
Git is a distributed version control system (DVCS) created by Linus Torvalds in 2005 (yes, the same person who created Linux). At its core, Git does one thing brilliantly: it tracks changes in your files over time, so you can recall any version of your project whenever you need it.
Before Git, developers shared code by emailing zip files or using fragile centralized systems where one bad commit could break everything for the entire team. Git solved all of that.
🏗️ Centralized vs. Distributed
To appreciate Git, you need to understand the two types of version control systems:
- Centralized (e.g., SVN): There is one central server. Every developer commits directly to it. If the server goes down, no one can work. If history is lost, it's gone forever.
- Distributed (Git): Every developer has a complete copy of the entire project history on their local machine. You can work fully offline, and no single point of failure can wipe out your project.
⚡ Why Every Developer Uses Git
- 🔗 Collaboration: Teams of thousands contribute to one codebase without stepping on each other's toes.
- 📜 History: Every change ever made is recorded — who made it, when, and why.
- 🌿 Branching: Experiment freely without breaking the working product.
- 🛡️ Safety: Made a mistake? Roll back to any previous state in seconds.
- 🚀 Speed: Almost all operations are local — no network round trips needed.
Git is not optional in modern development. It is the foundation every professional workflow is built on.
Deep Dive Analysis
Think of Git like a video game save system — but for your code. Every time you <strong>commit</strong>, Git takes a snapshot of all your files at that moment. If you break something later, you can load any previous save. Better yet, you can create parallel universes (branches) where you try risky changes — if they work, you merge them into your main game; if not, you delete that branch and the main game is untouched. Git stores these snapshots in a hidden <code>.git</code> folder inside your project. That folder <em>is</em> your entire repository — it contains every version of every file you've ever committed.
Implementation Reference
# Step 1: Create a new project folder
mkdir my-project
cd my-project
# Step 2: Initialize Git (creates a hidden .git folder)
git init
# Output: Initialized empty Git repository in /my-project/.git/
# Step 3: Tell Git who you are (one-time global setup)
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
# Step 4: Check the current state of your repo
git status
# Output: On branch main, No commits yet, nothing to commit
# Step 5: Create a file
echo "# My Project" > README.md
# Step 6: Stage the file (prepare it for a snapshot)
git add README.md
# Step 7: Commit — take the snapshot!
git commit -m "Initial commit: add README"
# Output: [main (root-commit) a3f8c21] Initial commit: add README# View all Git settings
git config --list
# View just your username
git config user.name
# Set your default editor to VS Code
git config --global core.editor "code --wait"
# Set default branch name to 'main' for new repos
git config --global init.defaultBranch mainCommon Pitfalls
- •Forgetting to run <code>git config --global user.name</code> and <code>user.email</code> — your commits will have wrong or missing author info.
- •Confusing Git with GitHub. Git is the tool; GitHub is just one place to store Git repos remotely.
- •Initializing Git inside your home directory (<code>~</code>) instead of your specific project folder — this tries to track your entire computer!
- •Deleting the <code>.git</code> folder thinking it's unnecessary — you'll lose all your project history.
Key Takeaways
Hands-on Practice
- ✓Install Git on your machine and verify with <code>git --version</code>.
- ✓Configure your global username and email using <code>git config --global</code>.
- ✓Create a new folder, initialize a Git repo, add a README.md file, and make your first commit.
- ✓Run <code>git log</code> after committing to see your commit in the history.
Expert Pro Tips
Interview Preparation
Q: What is the difference between Git and GitHub?
Master Answer:
<strong>Git</strong> is the version control software that runs locally on your computer — it tracks changes, manages history, and handles branching/merging. <strong>GitHub</strong> is a cloud platform that hosts Git repositories online, enabling collaboration, pull requests, and code reviews. You can use Git entirely without GitHub. GitHub is just one of many remote hosting options (GitLab, Bitbucket, etc.).
Q: What is the difference between a centralized and distributed VCS?
Master Answer:
In a <strong>centralized VCS</strong> (like SVN), there is a single central server and developers only have the latest version locally. In a <strong>distributed VCS</strong> (like Git), every developer has a complete clone of the entire repository including all history. This means you can work offline, operations are faster (local), and there is no single point of failure.
Q: What exactly is stored inside the .git folder?
Master Answer:
The <code>.git</code> folder is the repository itself. It stores: the complete history of all commits, all branches and tags, configuration settings, the staging area index, and Git's internal object database (blobs for file content, trees for directory structure, commit objects, and tag objects). Deleting this folder removes all version history.
Industrial Blueprint
"When NASA's Jet Propulsion Laboratory writes code for Mars rovers, they use Git. When thousands of engineers at Google, Meta, and Microsoft collaborate on a single codebase, they use Git. When you're fixing a bug at 2am and need to see what changed last Tuesday — Git has your back."
Simulated Scenarios
© 2026 DevHub Engineering • All Proprietary Rights Reserved
Generated on March 7, 2026 • Ver: 4.0.2
Document Class: Master Education
Confidential Information • Licensed to User