All 38 Git lessons

Every lesson pairs a real Git command with a live simulation of what it changes inside .git/ — objects, refs, and the index, step by step. Free forever, nothing to install.

Recommended path for beginners

New to Git? Start with lesson 1 and follow the numbered core lessons in order. Each lesson builds on the previous one; practical how-tos and common questions are listed below.

Start with lesson 1: What Is VCS? Version Control System Explained
1. What Is VCS? Version Control System Explained A version control system (VCS) tracks file changes over time. Learn what VCS means, how Git stores history, and how Git differs from GitHub. 2. How Git is Different Discover why Git's snapshot-based architecture, local-first operations, and content-addressable database set it apart from traditional VCS like SVN. 3. Install Git on Windows, macOS, and Linux Install Git on Windows with winget or Git Bash, on macOS with Homebrew, or on Linux with apt. Verify Git and fix common PATH problems. 4. Git Config: Set, List, and Locate Settings Learn how to set and inspect Git config values, choose global or repository-local scope, find config file locations, and see which value Git uses. 5. git init: Initialize a Repo and Bare Repos What git init does, how to initialize a repository, and when git init --bare creates a shared remote with no working tree. Includes examples. 6. git status Explained: How Git Tracks Changes Discover how git status works behind the scenes. Learn how Git compares workspace files, index manifest, and HEAD pointers to detect changes. 7. git add: Staging, Blobs, and Interactive Modes Understand how git add stages content into Git's index and blob database, and use git add -i or -p to choose paths or individual hunks. 8. git commit: Create a Commit (with Examples) See what git commit does, how to write a commit message, and how Git stores a tree object, commit object, and updated branch ref. 9. git log: Traversing Commit History Learn how to inspect your repository's history with git log. See how Git traverses the commit DAG (Directed Acyclic Graph) to render commit logs. 10. git branch Explained: How Git Pointers Work Learn how git branch works under the hood. Understand refs, HEAD, and how Git stores branches as tiny references in .git/refs/heads/. 11. git checkout: Switch Branches & HEAD Master git checkout under the hood. Learn how Git alters HEAD, index, and workspace files, and how to safely resolve the detached HEAD state. 12. git merge: Fast-Forward vs Three-Way Merge git merge joins two branch histories. See fast-forward and three-way merges, merge commits, and how conflicts happen inside .git/. 13. git rebase Explained git rebase replays your commits on another branch for a linear history. See what it rewrites inside .git/, when to rebase vs merge, and the golden rule. 14. git stash Guide: Saving Work Without Committing Master git stash under the hood. Learn how Git creates commit objects to temporarily store your work, track untracked files, and manage the stash stack. 15. git remote Guide: Managing Remote Repositories Master git remote to connect local repositories to GitHub or GitLab. Learn how remote tracking branches, refspecs, and .git/config entries work. 16. git fetch: Remote Tracking & Objects Learn how git fetch downloads commits, objects, and refs from remote repositories into .git/refs/remotes/ without altering your local workspace. 17. git pull: Fetch & Merge Changes Learn how git pull executes behind the scenes. Understand its fetch and merge/rebase steps, conflict resolution, and internal .git file updates. 18. git push: Uploading Commits & Refs Learn how git push uploads local commits to GitHub/GitLab. Understand fast-forward checks, force-with-lease safety, and internal ref updates. 19. git clone Explained: How Cloning Works git clone isn't copy-paste — it runs five Git commands in sequence and downloads the entire history. See exactly what lands inside .git/ when you clone. 20. Git Objects Explained: Inspect with cat-file Learn how blobs, trees, commits, and tags make up Git's object database, then use git cat-file -t, -s, and -p to inspect them. 21. Git Refs Explained: Heads, Tags & Remotes Git refs are pointers to commits. Learn how refs/heads, tags, HEAD, and remote refs work inside .git/ — with examples. 22. Git Packfiles Explained: Storage Optimization Discover how Git compresses history. Learn how loose objects are gathered into packfiles using delta compression to optimize disk space and network bandwidth. 23. Git Hooks Explained: Automating Git Workflows Learn how to automate workflows and enforce code standards with Git Hooks. Explore .git/hooks/ and write custom pre-commit and pre-push scripts. 24. git diff: What Changed and Why It Looks Empty git diff compares your working tree, the index, and commits. See exactly what changed, why it goes blank after git add, and how to read a hunk.

How-tos & common questions

How to Undo the Last Commit in Git Step-by-step guide on how to undo your last Git commit safely. Learn soft, mixed, and hard resets, fixing commit messages, and recovering lost work. How to Rename a Git Branch (Local & Remote) Step-by-step guide to renaming a local and remote Git branch without losing tracking references or history. How to Discard Local Uncommitted Changes in Git Learn how to discard untracked files, modified files, or staged changes in Git using git restore, git checkout, and git clean. How to Fix Git Merge Conflicts A complete beginner-friendly guide to understanding, fixing, and resolving merge conflicts in Git safely. Fix Detached HEAD in Git Understand what detached HEAD state means in Git, why it happens, and how to save your commits or safely return to a branch. Git Fetch vs Git Pull: What is the Difference? git fetch downloads remote changes without touching your code; git pull downloads and merges them. See the exact difference and which one is safe to run. Git Reset vs Revert vs Checkout: Which to Use? A clear comparison of git reset, git revert, and git checkout — when to use each command and how they affect your commits and working tree. How to Squash Commits in Git Learn how to combine multiple Git commits into a single clean commit using git rebase -i and git merge --squash. How to Change Git Commit Author Name and Email Step-by-step guide to updating the author name and email for the last commit or multiple past commits in Git. How to Delete a Git Branch (Local and Remote) Learn how to delete local branches and remote tracking branches in Git safely using git branch -d and git push origin --delete. What Is the .git Folder? The .git folder is the entire repository — objects, refs, and config all live there. See what every file inside .git/ does and whether you can delete it. Cherry-Pick a Commit in Git Learn how to use git cherry-pick to apply specific commits from one branch onto another without merging the entire branch. Remove a File from Git Without Deleting It Use git rm --cached to stop tracking a file without deleting it from disk. See the exact commands, examples, and how to ignore it afterward. Fix unrelated histories error Learn why Git throws the 'refusing to merge unrelated histories' error when pulling or merging and how to fix it using --allow-unrelated-histories.

Prefer to explore?

Jump straight into the interactive playground and experiment with Git safely in your browser.