Overview
This sequence provides a gentle, well-paced introduction to Git’s core functionality. By the end, you’ll understand how to make commits, create and manage branches, and combine work using merging and rebasing.Levels in This Sequence
The Introduction Sequence consists of four progressive levels:1. Introduction to Git Commits
What you’ll learn: The fundamental unit of Git - the commit. Key concepts:- A commit records a snapshot of all tracked files in your directory
- Git compresses commits as deltas (changes) rather than copying entire directories
- Commits maintain a history of when changes were made
- Each commit has parent commits, creating a commit tree
2. Branching in Git
What you’ll learn: How to create and switch between branches. Key concepts:- Branches are lightweight pointers to specific commits
- Creating branches has no storage overhead
- The mantra: “branch early, and branch often”
- Branches help you divide work logically
- HEAD indicates which branch you’re currently on (shown with an asterisk)
bugFix and switch to it.
Commands introduced:
Git 2.23 introduced
git switch as an alternative to git checkout, but this tutorial uses checkout as it’s more widely used.3. Merging in Git
What you’ll learn: How to combine work from different branches using merge. Key concepts:git mergecombines work from two branches- A merge creates a special commit with two parent commits
- After merging, the target branch contains all work from both branches
- Merge commits help preserve the full history of parallel development
4. Rebase Introduction
What you’ll learn: How to create a linear commit history using rebase. Key concepts:git rebasetakes commits and “copies” them to a new location- Rebasing creates a cleaner, more linear commit history
- The original commits still exist (shown faded), while new copies are created
- Rebase makes it look like features were developed sequentially, even when they were parallel
Merge vs Rebase
Both merge and rebase combine work from different branches, but they do it differently:| Aspect | Merge | Rebase |
|---|---|---|
| History | Preserves exact history with merge commits | Creates linear history |
| Commits | Creates new merge commit | Copies commits to new location |
| Use case | When you want to preserve full history | When you want clean, linear history |
| Collaboration | Safer for shared branches | Best for local branches |
What’s Next?
After completing the Introduction Sequence, you’ll be ready for:- Ramping Up: Learn about relative refs, detached HEAD, cherry-pick, and interactive rebase
- Moving Work Around: Master techniques for precisely moving commits
- Remote Repositories: Start collaborating with others using git remotes
Start Learning
Begin the Introduction Sequence in the interactive tutorial