Learn Git Visually
An interactive guide to version control. No jargon, no memorizing commands — just clear mental models you can actually use.
What is Git
Git is a version control system — it tracks every change you make to your files and lets you go back to any previous state. Think of it as an infinite undo system for your entire project.
Each circle is a saved snapshot of your project. Click the button to save a new version.
Without Git, people email files like design_v3_FINAL_really_final.fig. With Git, you have a clean timeline you can navigate, branch, and share. Every change is attributed to a person. Nothing gets lost.
Repositories
A repository (repo) is just your project folder — with a hidden .git directory where Git stores all its tracking data.
git init
# Clone an existing one
git clone https://github.com/user/project.git
git init creates the .git folder. That's it — your directory is now a Git repo. Everything Git knows lives in there.
Commits
A commit is a snapshot of your project at a specific moment. It records what changed, who changed it, and when. Each commit has a unique ID (a hash).
Stage files, write a message, and commit. This is the actual workflow.
git add index.html style.css
# Stage everything
git add .
# Commit with a message
git commit -m "Add navigation component"
Branches
Branches let you work on different things in parallel without affecting the main codebase. Every repo starts with one branch, usually called main.
Click to create a branch. Each branch is an independent line of work.
git checkout -b feature/new-header
# Or the modern way
git switch -c feature/new-header
# List all branches
git branch
A branch is just a pointer to a commit — it's incredibly lightweight. Creating a branch doesn't copy any files. It just says "this is where I'm working from now."
Merging
Merging takes the changes from one branch and combines them into another. It creates a special "merge commit" that ties the two histories together.
Watch what happens when a feature branch gets merged back into main.
git checkout main
# Merge the feature branch
git merge feature/new-header
Rebasing
Rebase does the same thing as merge — combines work from two branches — but creates a cleaner, linear history. This is the key decision you'll face in Git.
Toggle between merge and rebase to see the difference. Same changes, different history shape.
- • Shared/public branches
- • When history matters
- • Team collaboration
- • Pull requests
- • Your own local branches
- • Cleaning up before PR
- • Linear history preference
- • Keeping up with main
git checkout feature/new-header
git rebase main
# Golden rule: never rebase a branch others are working on
Push & Pull
Your commits are local until you explicitly share them. push sends your commits to a remote server. pull brings others' commits down to you.
Remote (GitHub)
Shared repository
Local (Your machine)
Your working copy
git push origin main
# Pull remote changes
git pull origin main
Fetch vs Pull
Both get data from the remote, but they do different things with it. fetch is safe and non-destructive. pull is fetch + merge in one step.
Remote
origin/main
Tracking Refs
origin/main (local copy)
Working Files
Your local main
git fetch origin
# See what changed
git log origin/main --oneline
# Then merge when ready
git merge origin/main
Conflicts
Conflicts happen when two branches change the same lines. Git can't decide which version to keep — you have to choose. It's not an error, it's a question.
Both sides changed the same code. Click the version you want to keep for each conflicting line.
Workflows
The "feature branch" workflow is the most common pattern. It keeps main clean and lets everyone work independently.
Create a branch
Branch off from main for your feature or fix.
git switch -c feature/new-header
Make commits
Work on your feature, committing as you go. Small, focused commits.
git add . && git commit -m "Add header layout"
Push & open PR
Push to remote, open a pull request for review.
git push origin feature/new-header
Code review
Team reviews your changes. You address feedback with new commits.
Merge to main
Once approved, merge your branch. Delete it after — it's done its job.
git checkout main && git merge feature/new-header
This workflow scales from solo projects to teams of hundreds. The key principle: main is always deployable. All experimental work happens on branches.
Playground
Free sandbox. Create commits, branches, and merges. See how the graph evolves.