🗂️ Git & GitHub — Visual Cheat Sheet

ELI5 Edition

💾 What is Git?

A save system for code. Every commit = a snapshot you can return to. Lives on your computer.


git init
Turn any folder into a git repo
git add .
Stage everything for saving
git commit -m "msg"
Save a snapshot with a label (-m = message)
git log
See all your saves + their IDs

☁️ What is GitHub?

Where you store your git saves online. Cloud backup + sharing + CI. Git works without it.


git push
Upload commits to GitHub
git pull
Download latest changes from GitHub
git clone <url>
Download an existing repo to your computer

🔄 The Basic Loop

✏️ Write Code
git add
git commit -m
git push
☁️ GitHub
💡 You can stack multiple commits before pushing — they all upload at once.

⏪ Going Back in Time

git checkout <id>
Peek at an old save (safe)
git reset --hard <id>
Rewind to a save, delete everything after
⚠️ reset --hard is permanent. Use checkout to just look around safely.

🚀 Starting a Project

GitHub first (easiest):

Create repo on GitHub
git clone
Work

Local first:

git init
Create empty repo on GH
git remote add origin

📥 When to git pull first

✅ Just start working if...

You're solo and nothing else touches the repo

⚠️ Pull first if...

Cursor, a cron job, or another person is also pushing changes