1. Introduction to Git
What is Git?
Git is a Distributed Version Control System (DVCS) that tracks changes in source code and allows multiple developers to collaborate efficiently.
Key Concepts:
- Snapshots, Not Diffs: Git stores complete snapshots of your project at each commit, not just file differences
- SHA-1 Hashes: Each commit is identified by a unique 40-character hexadecimal hash (e.g., `3a7d8f2`)
- Distributed: Every developer has a complete copy of the repository history
- Branching: Create isolated development branches for features without affecting the main code
- Staging Area: Control exactly what goes into each commit
Git Workflow (Working Directory → Staging → Repository)
Working Directory
(Local files)
→
Staging Area
(git add)
→
Repository
(git commit)
Pro Tip: The staging area lets you choose exactly which changes to commit, enabling atomic commits with related changes only.
BeginnerInstallation
Windows:
Download Git from https://git-scm.com/download/win Run installer with default settingsmacOS:
brew install gitLinux (Ubuntu/Debian):
sudo apt-get update sudo apt-get install gitVerify Installation:
git --version # Should show git version 2.x.x or higher