Introduction to Git
Git is a distributed version control system created by Linus Torvalds in 2005. It's the backbone of modern software development — every change you make, every bug you fix, every feature you ship is tracked by Git.
Why Git?
- Track every change to your codebase with full history
- Collaborate without overwriting each other's work
- Roll back mistakes instantly to any previous state
- Branch freely, experiment safely, merge confidently
Core concepts
- Repository: the database of all your project history (the
.gitfolder) - Commit: a snapshot of your files at a point in time
- Branch: a lightweight pointer to a commit
- Working tree: your current files on disk
- Staging area (index): changes queued for the next commit
Your first repo
git init my-project
cd my-project
echo "# Hello" > README.md
git add README.md
git commit -m "Initial commit"