Building Module 7 · Git Basics

Saving Your Work

status, log, diff — and pushing to GitHub

Checking your work

Before and after committing, there are three commands that help you understand what’s going on:

git status — What’s changed?

Terminal window
git status

This shows:

  • Untracked files — new files git doesn’t know about yet
  • Modified files — existing files that have changed
  • Staged files — files ready to be committed

Run this frequently. It’s your dashboard.

git log — What have I committed?

Terminal window
git log --oneline

This shows a list of your commits, newest first:

a1b2c3d Add contact form with validation
e4f5g6h Update homepage hero section
i7j8k9l Initial commit

Each line shows a unique commit ID (the letters/numbers) and your commit message. The --oneline flag keeps it compact.

git diff — What exactly changed?

Terminal window
git diff

This shows line-by-line what changed in your files since the last commit. Lines starting with + were added, lines starting with - were removed.

<h1>Welcome</h1>
<h1>Welcome to My Portfolio</h1>

Undoing mistakes

One of git’s greatest powers is letting you undo things:

Undo changes to a specific file (before committing)

Terminal window
git checkout -- filename.txt

This reverts the file to its last committed version. The changes are gone.

Undo all changes since last commit

Terminal window
git checkout .

This reverts all files. Use with caution — all uncommitted changes are lost.

Undo the last commit (keep the changes)

Terminal window
git reset --soft HEAD~1

This undoes the commit but keeps your file changes. Useful when you committed too early or with the wrong message.

When in doubt, commit first

Before running any AI tool or making big changes, do a quick git add . && git commit -m "Save point before changes". This guarantees you can always get back to a working state.

Pushing to GitHub

So far everything has been local — saved on your computer only. To back up your work and share it, push to GitHub.

Step 1: Create a GitHub repository

  1. Go to github.com and sign in (create an account if needed)
  2. Click the + button → New repository
  3. Name it (e.g., my-project)
  4. Keep it Public or Private — your choice
  5. Don’t add a README, .gitignore, or license (you already have files)
  6. Click Create repository

Step 2: Connect your local project to GitHub

GitHub will show you commands. Copy and run them:

Terminal window
git remote add origin https://github.com/YOUR-USERNAME/my-project.git
git branch -M main
git push -u origin main

Let’s break these down:

  • git remote add origin — tells git where to upload (the GitHub URL)
  • git branch -M main — renames your branch to “main” (the convention)
  • git push -u origin main — uploads your commits to GitHub

Step 3: Future pushes

After the initial setup, pushing new work is just:

Terminal window
git push

One command. Your code is backed up in the cloud.

The daily workflow

Here’s the complete workflow you’ll follow for every project:

Terminal window
# Start of work session
git status # Check current state
# Make changes (AI tools, manual editing, etc.)
claude # or gemini, codex, etc.
> "Add a navigation bar to the site"
# Save your work
git add .
git commit -m "Add responsive navigation bar"
# Back up to GitHub
git push

Repeat this cycle as many times as you like during a session. Each commit is a save point. Each push is a backup.

Quick reference

I want to…Command
See what’s changedgit status
See commit historygit log --oneline
See exact changesgit diff
Stage all changesgit add .
Commit changesgit commit -m "message"
Push to GitHubgit push
Undo uncommitted changesgit checkout .
Undo last commit (keep files)git reset --soft HEAD~1

You now know enough git for 95% of what you’ll do as an orchestrator. There’s much more to git (branches, merging, rebasing), but you can learn those when you need them — and even then, you can ask your AI tool to help you with the commands.