ctrl + Q ACADEMY • ARCHITECTURE CORE

Version Control: Git & GitHub

Track changes, collaborate safely, and never lose work again.

Tier 1: Local Basics
Basics

Init, Add & Commit

Git tracks a project's history as a series of commits — snapshots of your files. The staging area (git add) lets you choose exactly which changes go into the next commit, separate from your working files.

terminal
git init
git add index.html
git commit -m "Add initial homepage markup"
git log --oneline
Basics

Status, Diff & .gitignore

git status shows what's changed; git diff shows exactly which lines changed. A .gitignore file lists files Git should never track (build output, secrets, dependency folders like node_modules/).

Tier 2: Branching & Merging
Critical Spec

Branches & Merge Conflicts

A branch is an independent line of development, letting you build a feature without touching the stable main branch. A merge conflict happens when two branches change the same lines differently — Git marks the conflicting section and asks you to resolve it manually.

terminal
git checkout -b feature/login-form
# ...make changes, commit them...
git checkout main
git merge feature/login-form
Tier 3: Collaboration on GitHub
Professional

Remotes, Push/Pull & Pull Requests

A remote (like GitHub) is a hosted copy of your repository. git push uploads local commits; git pull downloads and merges remote changes. A pull request proposes merging one branch into another and gives teammates a place to review the diff before it lands.

terminal
git remote add origin https://github.com/user/repo.git
git push -u origin feature/login-form
git pull origin main
Tier 4: Advanced Workflows
Advanced

Stashing Changes

git stash temporarily shelves uncommitted changes so you can switch branches with a clean working directory, then reapply them later with git stash pop. It's the fastest way to context-switch without making a throwaway commit.

terminal
git stash                 # save uncommitted changes
git checkout main
# ...handle something urgent...
git checkout feature/login
git stash pop              # restore the stashed changes
Advanced

Rebasing vs. Merging

git merge combines two branches and preserves history exactly as it happened, including a merge commit. git rebase instead replays your branch's commits on top of another branch, producing a linear history — useful for a clean log, but it rewrites commit hashes, so avoid rebasing commits that are already shared/pushed with others.

terminal
git checkout feature/login
git rebase main            # replay feature commits on top of main
Quiz: What command uploads your local commits to a remote repository?
Final Assessment

Ready to test what you've learned?

Take the Git & GitHub certification exam — 8 questions, 70% to pass. Passing unlocks a downloadable certificate with your name on it.