Skip to content

Cheatsheet: Your first repo

Git stores snapshots. Every other command is just navigating those snapshots.

CommandPurposeExample
git initCreate new repogit init
git statusShow current stategit status
git add <file>Stage a changegit add notes.txt
git add .Stage everything in current dirgit add .
git commit -m "msg"Take a snapshotgit commit -m "Add notes"
AreaWhat it holdsHow you change it
Working directoryFiles as they exist on disk right nowEdit files in any way (editor, file manager)
Staging areaA draft of the next snapshotgit add moves changes here
RepositoryPermanent history of all snapshotsgit commit saves the staging area as a new snapshot
  1. Edit files
  2. git add <files>
  3. git commit -m "meaningful message"
  4. git status (confirm clean state)

Minimal .gitignore (start here, add as needed)

Section titled “Minimal .gitignore (start here, add as needed)”
# Build output
dist/
build/
# Dependencies (use bare name for symlink-safe matching)
node_modules
# Editor files
.idea/
.vscode/
*.swp
# Secrets
.env
.env.local
# OS artifacts
.DS_Store
Thumbs.db

L3 teaches commit hygiene: writing meaningful commit messages, making commits atomic (one logical change per commit), and the Conventional Commits convention popular on many teams. The mechanics are now muscle memory; L3 adds the discipline that makes the muscle memory useful over time.