Git Introduction
In this page:
What is Git?
Git is a free, open-source distributed version control system built to handle everything from tiny scripts to massive codebases like the Linux kernel with speed and efficiency. It tracks every change made to your files over time, so a team of developers can work on the same codebase in parallel without overwriting each other's work.
Example: What is Git?
git init
git add file.txt
git commit -m "Track file.txt in Git"
Why Use Version Control?
Version control lets you save numbered snapshots of your project as you go, so a bad edit is never permanent -- you can always roll back to a known-good state. Beyond safety, it's the backbone of collaboration: platforms like cookiescursor.com use it to let many contributors merge work into one shared history.
Example: Why Use Version Control?
git log --oneline
git checkout <commit-hash> -- file.txt
Centralized vs. Distributed VCS
Centralized systems (like old-style SVN) require a live connection to one central server just to see history or commit. Git is distributed instead: every clone carries the entire project history locally, so you can commit, branch, and inspect logs completely offline, then sync with others whenever you have a connection.
Example: Centralized vs. Distributed VCS
git clone https://github.com/user/repo.git
cd repo
git log
Key Terminology
Four terms carry most of Git's vocabulary: a Repository is the tracked project folder, a Commit is one saved snapshot with a message describing what changed, a Branch is an independent line of development you can experiment on safely, and HEAD is simply a pointer to whichever commit or branch you currently have checked out.
Example: Key Terminology
git init myrepo
git commit -m "Initial commit"
git branch feature-login
Verifying Your Setup
Before creating your first repository, it's worth confirming your terminal can actually talk to Git -- running a simple version-check command verifies the executable is installed and on your system PATH, saving you a confusing error later when a real command silently fails.
Example: Verifying Your Setup
git --version
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: