Git Notes
Git is a free, open-source distributed version control system designed to handle everything from small personal projects to massive enterprise codebases...
Git is a free, open-source distributed version control system designed to handle everything from small personal projects to massive enterprise codebases with speed and efficiency. Created in 2005 by Linus Torvalds (the creator of Linux), Git has become the industry standard for source code management, used by over 90% of software developers worldwide. Understanding Git is not optional in modern development — it is as essential as knowing a programming language.
Git in Simple Terms
At its most basic, Git is a tool that takes snapshots of your project over time. Every time you save a checkpoint (called a "commit"), Git records the exact state of every file. You can then travel back to any of these checkpoints, compare changes between them, or branch off in multiple directions simultaneously.
Think of Git as a time machine for your code. Made a terrible mistake? Travel back to yesterday. Want to try a risky experiment? Create a parallel universe (branch) where you can experiment without affecting the stable version.
Why Git Was Created
Before Git, the Linux kernel (millions of lines of code, thousands of contributors) used a proprietary tool called BitKeeper. When the free license was revoked in 2005, Torvalds decided to build his own system with specific goals:
- Speed — Operations should be nearly instantaneous
- Simplicity — Simple design with the ability to handle complex workflows
- Strong support for branching — Thousands of parallel branches should be effortless
- Fully distributed — Every developer has the complete history
- Ability to handle large projects — Scale to the Linux kernel's needs
Git achieved all of these goals and has remained the dominant version control system since its creation.
How Git Works
Snapshots, Not Differences
Most version control systems store changes (deltas) — "file X was changed by adding these 3 lines." Git takes a different approach: it stores complete snapshots of your project at each commit. If a file has not changed, Git does not store it again — it stores a reference to the previous identical version. This makes Git incredibly fast for most operations.
Everything Is Local
Most Git operations require only local files — no network access needed. You can commit, branch, merge, view history, and do diffs entirely offline. This makes Git feel almost instantaneous compared to centralized systems that need to communicate with a server for every operation.
Three States
Git has three main areas where files live:
- Working Directory — Where you edit files normally
- Staging Area (Index) — Where you prepare the next commit
- Repository (.git) — Where committed snapshots are stored permanently
# File is modified in working directory
echo "new code" >> app.js
# Move to staging area
git add app.js
# Save to repository as a permanent snapshot
git commit -m "Add new feature"Core Features
Complete History
Every commit stores a full snapshot with metadata:
- Who made the change (author)
- When it was made (timestamp)
- What changed (file differences)
- Why it was made (commit message)
- A unique identifier (SHA-1 hash)
Branching and Merging
Git's branching model is its superpower. Creating a branch is nearly instantaneous (just creating a 41-byte file), making it practical to branch for every feature, bug fix, or experiment:
git branch experiment # Create in microseconds
git checkout experiment # Switch instantly
# Work, commit, test...
git checkout main
git merge experiment # Combine the workData Integrity
Every file and commit in Git is checksummed using SHA-1 hashing. This means it is impossible to change any file or history without Git knowing about it. Your repository integrity is mathematically guaranteed.
Distributed Architecture
Every clone of a Git repository is a complete backup:
git clone https://github.com/project/repo.git
# You now have EVERYTHING — all branches, all history, all tagsIf the server fails, any developer's local copy can reconstruct the entire project.
Git vs Other Tools
| Feature | Git | SVN | Perforce |
|---|---|---|---|
| Architecture | Distributed | Centralized | Centralized |
| Offline work | Full capability | Very limited | Very limited |
| Branching speed | Instantaneous | Slow | Moderate |
| Storage | Snapshots | Deltas | Deltas |
| Learning curve | Steeper | Gentler | Moderate |
Where Git Is Used
- Software development — The primary use case
- DevOps and Infrastructure — Infrastructure as Code (Terraform, Kubernetes configs)
- Data Science — Tracking notebooks, models, and experiments
- Technical writing — Books, documentation, specifications
- Web development — Frontend, backend, and full-stack projects
- Open source — The backbone of collaborative development worldwide
Getting Started
# Check if Git is installed
git --version
# Configure your identity
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
# Create your first repository
mkdir my-project && cd my-project
git init
echo "Hello, Git!" > README.md
git add README.md
git commit -m "My first commit"Key Takeaways
Git is a distributed version control system that tracks changes to your project through snapshots. It works locally for speed, uses staging for precise commits, and distributes complete copies to every developer for resilience. Git's branching model enables parallel development at any scale, and its data integrity guarantees make your project history trustworthy. Every professional developer needs Git — it is the universal language of code collaboration.
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for What Is Git.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Git & GitHub topic.
Search Terms
git-github, git & github, git, github, introduction, what, what is git
Related Git & GitHub Topics