Git Learning Roadmap
Follow the structured path from essential commits to advanced branching, rebasing, and conflict recovery. Select any topic to review the concept or practice interactively.
Station 1: Initializing a Repository
Every Git journey begins by initializing a `.git` hidden database in your project folder. Type `git init` to set up your project repository.
Stage 1: Repository Fundamentals
Initializing a Repository
Every Git journey begins by initializing a `.git` hidden database in your project folder. Type `git init` to set up your project repository.
The 3 Zones & File Status
Git separates files into 3 zones: Working Tree (unstaged edits), Staging Area (prepared box), and Commit History (saved permanently).
Permanent Snapshots (Commits)
A commit records a permanent cryptographic snapshot of all staged files with a clear message and author timestamp.
Reading History (Log & Graph)
`git log` allows you to inspect past project commits. The `--oneline` flag formats the log into a clean compact summary.
The Observer (HEAD & Detached Mode)
HEAD is the camera lens of Git. Moving HEAD to an earlier commit puts you into Detached HEAD mode so you can inspect past code.
Selective Staging (Precision Adds)
Instead of staging everything with `git add .`, stage individual files (`git add api.ts`) to keep commits atomic.
Stage 2: Branching & Merging Strategies
Parallel Realities (Branches)
Branches create an isolated timeline for new feature development without touching the stable `main` branch.
Deleting Merged Branches
Once a feature branch has been merged into main, deleting the branch keeps your repository clean.
Fast-Forward Merges
When `main` has no new commits since branching, Git fast-forwards the `main` pointer straight to the feature tip.
Three-Way Merge Commits
When both `main` and `feature` have new commits, a 3-way merge brings both storylines together with a merge commit.
Linear Rebasing (`git rebase`)
Rebase replays your feature commits on top of the latest `main`, creating a perfectly linear history without merge bubbles.
Cherry-Picking Single Commits
Want a single specific bugfix commit from another branch without merging all the experimental code? Use `git cherry-pick <sha>`.
Stage 3: Precision Control & Undoing Mistakes
Amending Commits (`commit --amend`)
Forgot to add a file or made a typo in your last commit message? `git commit --amend` updates the last snapshot in place.
Unstaging Files (`git restore`)
Accidentally staged a secret or test file? Use `git restore --staged <file>` to safely unstage it without losing your edits.
The 3 Resets (`--soft`, `--mixed`, `--hard`)
`git reset` moves HEAD backwards in time. `--soft` preserves staged changes, `--mixed` preserves uncommitted files, and `--hard` discards everything.
Safe Public Undoing (`git revert`)
If a bad commit is already pushed to GitHub, you cannot use reset! `git revert <sha>` safely inverts the bad commit by adding a new inverse snapshot.
The Stash Pocket (`git stash`)
Need to switch branches urgently for a hotfix but have unfinished work? Stash lets you tuck uncommitted files away safely and pop them back later.
Stage 4: Remotes & Disaster Recovery
Remote Tracking & Synchronization
Remote branches like `origin/main` track code on GitHub. Learn how `git fetch` checks for updates without touching your local working files.
Merge Conflict Resolution Studio
When two branches edit identical lines, `git merge` halts and prompts you to resolve the collision before finalizing the merge commit.
Interactive Rebase Studio (`rebase -i`)
Interactive rebase lets you clean up messy commits (like "fix typo", "oops") into one clean commit before merging.
Reflog Disaster Recovery
Accidentally ran `git reset --hard` and lost your work? Git reflog keeps a secret journal of every HEAD movement so you can resurrect lost commits!
Release Tagging (`git tag`)
Tags mark permanent release milestones (e.g. `v1.0.0`, `v2.4.1`) in your Git history so deployments can reference fixed versions.