What is Git & Version Control?
The Problem Git Solves
Imagine you're writing an essay and you save it as essay_final.docx. Then you make changes and save essay_final_v2.docx. Then essay_REALLY_final.docx. Sound familiar?
Software is the same, but with hundreds of files and multiple people. Without a system, you end up with chaos — overwritten work, no record of what changed, and no way to undo a bad decision.
Version control is a system that tracks every change to your files over time. You can see who changed what, when, and why — and you can go back to any previous state at any moment.
What is Git?
Git is the world's most popular version control system. It was created in 2005 by Linus Torvalds (the creator of Linux) because he needed something fast, distributed, and free.
How Git Thinks About Files
Most systems store changes as differences ("file A changed from X to Y"). Git works differently — it stores snapshots. Every time you save a version (called a commit), git takes a picture of all your files at that moment.
You'll learn each step in the next modules. For now, remember the three stages:
- Working directory — the files you're editing right now
- Staging area — files you've marked as "ready to save"
- Repository (commits) — the permanent history of saved snapshots
Why Developers Love Git
- History — every change is recorded with a message explaining why
- Branching — work on new features without touching the main codebase
- Collaboration — multiple people can work on the same project simultaneously
- Recovery — made a mistake? Roll back to any previous state instantly
- Speed — most operations run entirely on your local machine
Git vs GitHub
These are often confused. Here's the difference:
- Git — the tool. Runs on your computer. Tracks history locally.
- GitHub — a website. Hosts your git repos in the cloud. Adds collaboration features like pull requests and issues.
Other hosting platforms like GitLab and Bitbucket also work with git. Git is the standard; the platform is your choice.
Your Challenge
git --version in the terminal to see git in action
git help to see the list of common commands