Free lesson · How Git Actually Works

How to use this course

Most people learn about six Git commands, get away with it for years, and then panic the first time a rebase goes sideways. This course is built on the opposite bet: that twenty minutes spent on how Git stores data saves you years of guessing.

The shape of the course

SectionsWhat you get out of it
1–2 · FoundationsThe object model, the index, and everyday committing. After this, commands stop being magic incantations.
3–4 · HistoryBranching, merging, rebasing, and how to recover absolutely anything you think you have lost.
5–6 · CollaborationRemotes, forks, branching strategies, pull requests, review and branch protection.
7–8 · GitHub ActionsWorkflow syntax from first principles, then real pipelines: matrices, caching, artifacts, services, reusable workflows.
9 · Delivery & securityEnvironments, approvals, keyless cloud deploys with OIDC, and hardening against supply-chain attacks.
10 · Final examA timed assessment across everything.

Each section has written lessons, a mid-section knowledge check with immediate answers, a timed assessment whose answers unlock once you pass, and a printable PDF handout.

How to actually study this

Git is a subject where reading alone produces false confidence. Keep a scratch repository open while you read:

mkdir git-practice && cd git-practice
git init
echo "one" > a.txt && git add . && git commit -m "first"

When a lesson shows a command, run it. When it describes a state, check it with git log --oneline --graph --all and git status. You cannot break anything in a scratch repository, and Section 4 teaches you to recover from what you can break in a real one.

A note on command style

This course prefers git switch and git restore over the older git checkout for branch switching and file restoration. checkout does both jobs plus several others, and that overloading is a genuine source of accidents. checkout still works and you will meet it everywhere, so both are shown.

What you need

  • Git 2.30 or newer (git --version). Anything from the last few years is fine.
  • A GitHub account. The free tier covers everything in this course, including Actions minutes on public repositories.
  • A terminal. The concepts apply identically in a GUI, but a GUI hides exactly the mechanics we are trying to make visible.
Set these two things first

If you have not configured Git before, do this now — otherwise your commits are attributed to nobody:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main

This is one lesson of 52

Git & GitHub Actions: Version Control and CI/CD in Depth continues from here — 5 lessons are free to read like this one, and the rest come with the course. Enrolled readers also get an AI tutor that has read the lesson they are on.

See the full course