Learn Git by doing

A free, interactive Git tutorial. Join a small team, run real git commands in your browser, and learn commits, branches, merges, conflicts, pull requests, stash, reset and more.

The tutorial

  1. Get the code: Clone a real project with git clone and read its history with git log.
  2. Save a change: Edit a file, check it with git status and git diff, stage it with git add, commit it and push it.
  3. Branches: Create a branch with git switch -c, work on it, switch back, and merge it with a fast-forward.
  4. Teamwork: Fetch and pull your teammates' commits, get a push rejected, and fix it with a merge commit.
  5. Conflicts: Change the same line as a teammate, read the conflict markers, resolve them, and finish the merge.
  6. Pull requests: Review and merge a teammate's pull request, push your own branch with -u, open a PR, and clean up.
  7. Undo mistakes: Unstage and discard changes with git restore, and undo a pushed commit safely with git revert.
  8. Stash: Put unfinished work aside with git stash to make an urgent fix, then bring it back with git stash pop.
  9. Fix your commits: Fix a commit with --amend, undo it with git reset --soft and --hard, and recover it with git reflog.

Git guides

Git cheat sheet

Questions

Is this Git tutorial free?
Yes. It's free, runs entirely in your browser, and needs no account or install.
Do I need to install Git?
No. The tutorial simulates a real Git repository, a terminal and GitHub in your browser. The commands are exactly the ones you'll use with real Git.
How is this different from other Git tutorials?
You work on a real-looking project with simulated teammates who push commits, open pull requests and create conflicts, so you practice collaboration, not just commands in isolation.
What will I learn?
Cloning, committing, the staging area, branches, merging, fetch and pull, resolving merge conflicts, pull requests, undoing mistakes with restore and revert, git stash, commit --amend, reset and reflog.
How long does it take?
About an hour for all nine chapters. Your progress is saved, so you can stop and come back anytime.