Everything Git can do,
one topic at a time.
A practical reference for version control — from the first commit to bisecting a regression, recovering “lost” work, and rewriting history safely.
Press
/ to search
Hover code to copy
Git 2.40+
Foundations
Mental modelGit stores snapshots , not diffs. Every commit is a full picture of your project, identified by a hash, pointing back to its parent(s). Branches are…Setup & configConfig lives at three levels: --system , --global (your user), and --local (this repo). More specific wins.Starting a repoTurn the current directory into a Git repository. Download a full copy including history.
Everyday
Staging & committingThe staging area lets you craft exactly what goes into each commit — even individual lines of a file.Inspecting historyMany ways to slice history. Find when a string was added or removed. Inspect any object. Line-by-line authorship. Fast grep over tracked…BranchingBranches are cheap — a 41-byte file. Make one for every feature, fix or experiment.Merging & rebasingTwo ways to integrate work. Merge preserves history exactly as it happened. Rebase replays your commits on top of another branch for a linear history.Remotes & collaborationNamed URLs for other copies of the repo. fetch downloads; pull = fetch + merge (or rebase). Publish your commits. Pull upstream changes…
Recovery
Undoing thingsPick the tool by what you want to undo and whether it’s been pushed .StashingShelve uncommitted work so you can switch context, then bring it back.Reflog: the safety netGit records every move of HEAD for ~90 days. If you committed it, you can almost always get it back — even after a bad reset --hard or a deleted…
Power tools
Rewriting historyInteractive rebase turns a messy series of commits into a clean story before you share it.Cherry-pick & patchesCopy specific commits onto the current branch. Share commits without a shared remote. See what changed between rebases of a PR.BisectBinary-search your history to find the exact commit that introduced a bug. 1,000 commits → about 10 steps.WorktreesCheck out several branches at once in separate folders, sharing one repository. No more stashing to review a PR or ship a hotfix.Tags & releasesAnnotated tags store author, date and message — use them for releases.Submodules & sparseEmbed another repo at a pinned commit. Only materialize the folders you need in a huge monorepo. Keep big binaries out of the object…HooksScripts in .git/hooks/ that run on events. Exit non-zero to block the action.
Troubleshooting
Common problemsThe error messages you’ll actually hit, what causes them, and how to fix them. Search for words from your error to jump straight to it.Debugging Git itselfWhen Git does something you don’t expect, make it show its work.