Git Crash Course
“I’m an egotistical bastard, and I name all my projects after myself. First Linux, now Git.” - Linus TorvaldsGit is not just a tool. It is the foundation of modern software development. Every professional developer uses it. Every open source project depends on it. Every company you will ever work for expects you to know it. This course takes you from git-curious to git-confident.
Why Git Matters
Every professional developer uses version control. Here’s why Git won:Distributed
Every developer has the full history. No single point of failure. Work offline.
Fast
Branching and merging are instant. Designed for the Linux kernel (millions of lines).
Industry Standard
GitHub, GitLab, Bitbucket—all built on Git. 97% of developers use it.
Powerful
Branching strategies, rebasing, cherry-picking—handle any workflow.
The Story Behind Git
2005: Linus Torvalds needed a version control system for Linux kernel development. The existing tool (BitKeeper) became proprietary. The Solution: Linus built Git in just 10 days. His goals:- Speed (handle Linux kernel scale)
- Distributed (no central server dependency)
- Data integrity (cryptographic hashing)
- Non-linear development (branching)
- 100+ million repositories on GitHub
- Every major open source project
- Companies from startups to Google, Microsoft, Facebook
What You’ll Learn
Fundamentals
Repositories, commits, the staging area. The mental model that makes everything else click.
Start Here
Branching and Merging
Create branches in milliseconds, merge with confidence, resolve conflicts like a pro.
Learn Branching
Collaboration
Remote repositories, push/pull workflows, pull requests, code review. Working with teams.
Collaborate
Advanced Topics
Rebase vs merge (the eternal debate), interactive rebase, cherry-pick, stash. Power user territory.
Go Advanced
Internals Deep Dive
The object model, SHA-1 hashing, packfiles, refs. If you love understanding how things actually work, this one is for you.
Explore Internals
Git Hooks
Automate workflows, enforce standards, integrate with CI/CD. Git as a platform.
Learn Hooks
Git vs Other Version Control Systems
| Feature | Git | SVN | Mercurial |
|---|---|---|---|
| Architecture | Distributed | Centralized | Distributed |
| Speed | Very Fast | Slow | Fast |
| Branching | Instant, cheap | Slow, expensive | Fast |
| Offline Work | Full functionality | Limited | Full functionality |
| Market Share | ~97% | ~2% | ~1% |
| Learning Curve | Moderate | Easy | Easy |
Core Concepts Preview
The Three States
Every file in Git is in one of three states:- Modified: Changed but not staged
- Staged: Marked for next commit
- Committed: Safely stored in repository
The Three Areas
- Working Directory: Your actual files
- Staging Area (Index): Prepared changes
- Repository (.git): Committed history
Why Developers Love Git
Branching is Cheap
Branching is Cheap
Create a branch in milliseconds. Experiment freely. Delete failed experiments.
Complete History
Complete History
Every commit is a snapshot. Travel back in time. Find when bugs were introduced.
Collaboration
Collaboration
Multiple developers, same codebase, no conflicts (mostly). Pull requests for code review.
Safety
Safety
SHA-1 hashing ensures data integrity. Almost impossible to lose committed work.
Real-World Use Cases
Solo Projects
Track changes, experiment with branches, never lose work
Team Development
Parallel feature development, code review, merge strategies
Open Source
Fork projects, submit pull requests, contribute to Linux, React, etc.
DevOps/CI/CD
Trigger builds on push, deploy from branches, GitOps workflows
Prerequisites
What You Need:
- Basic command line knowledge (cd, ls, mkdir)
- A text editor (VS Code, Sublime, Vim)
- Git installed on your system
- Windows: Download from git-scm.com
- macOS:
brew install gitor Xcode Command Line Tools - Linux:
sudo apt install git(Ubuntu) orsudo yum install git(RHEL)
Course Structure
This crash course is designed to take you from zero to productive in 8-10 hours.Module 1: Fundamentals (2-3 hours)
Git installation, configuration, the mental model. Creating repositories, staging changes, making commits. Understanding the three states and three areas.Module 2: Branching and Merging (2-3 hours)
Branch creation (it is instant, abuse this), switching contexts, merging strategies, conflict resolution. The workflows that make teams productive.Module 3: Collaboration (2-3 hours)
Remotes, cloning, fetching, pulling, pushing. Forking repos, creating pull requests, code review etiquette. GitHub/GitLab workflows.Module 4: Advanced Topics (2-3 hours)
The rebase vs merge debate (both have their place), interactive rebase for clean history, cherry-picking commits, stashing work in progress.Module 5: Internals Deep Dive (1-2 hours)
The object database, content-addressable storage, SHA-1 hashing, packfiles, refs. If you love internals, continue. If not, you are still a competent Git user.Module 6: Git Hooks (1 hour)
Pre-commit hooks, pre-push hooks, server-side hooks. Automate quality gates and integrate with CI/CD.Common Git Workflows
- Feature Branch
- Gitflow
- Trunk-Based
Git Best Practices
What Makes Git Powerful
- Snapshots, Not Diffs: Git stores complete snapshots, making operations fast
- Local Operations: Most operations are local, no network needed
- Integrity: Everything is checksummed (SHA-1), corruption is detected
- Append-Only: Git generally only adds data, hard to lose committed work
- Branching Model: Branches are just pointers, making them lightweight
Learning Path
Success Metrics
By the end of this crash course, you will be able to:- Initialize repositories and make commits without thinking
- Create and merge branches with confidence
- Resolve merge conflicts (they are not as scary as they seem)
- Collaborate using GitHub/GitLab like you have done it for years
- Use advanced features like rebase, cherry-pick, and interactive staging
- Understand Git internals and troubleshoot when things go wrong
- Follow industry-standard workflows (GitFlow, trunk-based, feature branches)
Ready to master Git? Start with Git Fundamentals or jump to Internals Deep Dive if you want to understand how Git really works.