learngit
The basicsLevelsReferenceStart learning

Learn Git by doing

Build a repository, one commit at a time.

Everything else explains rebase in prose, or shows it in a video while you watch. This hands you the repo: your files, the staging area, and the commit graph, side by side, changing as you type.

  • 8 chapters
  • 33 levels
  • about 90 minutes
  • no install
HistoryTwo commits on feature, cut from an old main.

The command is already typed. Press enter and watch which commits move, and which ones do not.

Three places, one change

Almost every Git command moves work between these three places. Once you can picture them, the commands stop being magic, and the workspace shows all three at once.

01Your files
Working treeThe folder you actually edit. Git watches it but records nothing on its own.touch notes.md
02The waiting room
Staging areaA list of the exact changes that will go into your next commit.git add notes.md
03Permanent record
HistoryA chain of commits, each one a snapshot plus a message and an author.git commit -m "add notes"

What you’ll be able to do

Not “understand”. Do it, on a keyboard, without looking it up.

git rebaseRebase on purposeNot by pasting a command off a wiki and hoping it works out.
--ontoTransplant a branchMove the two commits you meant and leave the rest exactly where they are.
--continueResolve a conflictRead the markers, blend both sides, and know what --abort costs you.
--force-with-leasePush without fearUnderstand why a push is rejected, and which force flag has a guard rail.
git resetRead all three resetssoft, mixed, hard, and which of the three trees each one touches.
git reflogUndo the unrecoverableBring back a branch you were sure a hard reset had destroyed.

8 chapters

Chapter 4 gets the most minutes because rebase is the reason this exists; chapter 8 adds no new commands at all, because retrieval practice is what actually moves knowledge into long-term memory.

  1. 01CommitsFiles, staging, commits, and reading history.3 levels
  2. 02BranchesA branch is a pointer. Everything else follows from that.4 levels
  3. 03MergeFast-forward, real merges, and what a second parent means.4 levels
  4. 04RebaseReplaying commits onto a new base, and transplanting a branch.5 levels
  5. 05ConflictsMarkers, --continue, --abort, ours versus theirs.4 levels
  6. 06RemotesFetch, pull, push, and why a push gets rejected.5 levels
  7. 07Undoreset, revert, reflog, and which of them rewrite history.5 levels
  8. 08Boss levelNo new commands. Real scenarios, start to finish.3 levels

The sandbox is already open.
That’s the entire idea.

The one thing that reliably teaches Git is seeing the graph change under your own commands. That normally needs a repo you are not afraid to break, which needs setup, which is where most people quit. So there is no setup, and nothing here can touch a real repository.