Git
Track every change, never lose work.
Git is a version control system. It records every change you make to your files, so you can always go back to previous versions.
Why Git Matters for AI Workflows
When AI edits your files directly, you need a safety net:
| Without Git | With Git |
|---|---|
| AI makes a mistake → you lose work | AI makes a mistake → you revert |
| "What did AI change?" → you guess | "What did AI change?" → you see exactly |
| Undo is one step back | Undo is unlimited |
Git isn't just for programmers anymore. It's essential for anyone letting AI modify their files.
Core Concepts
Repository
A folder tracked by Git. All changes inside this folder are recorded.
Commit
A snapshot of your files at a point in time. Like a save point in a video game.
Diff
The difference between two versions. Shows exactly what changed.
Getting Started
Install Git
Mac:
# Usually pre-installed. Check with:
git --version
# If not installed:
brew install git
Windows: Download from git-scm.com
Linux:
sudo apt install git # Ubuntu/Debian
sudo dnf install git # Fedora
Configure Git
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
Essential Commands
Start tracking a folder
cd my-project
git init
See what changed
git status
Save your changes
git add .
git commit -m "Describe what changed"
View history
git log --oneline
See what AI changed
git diff
Undo AI's changes (before committing)
git checkout -- filename
Go back to a previous version
git revert HEAD
A Typical Workflow
- Before AI edits: Make sure your work is committed
- AI makes changes: Review the diff
- If good: Commit with a descriptive message
- If bad: Revert the changes
# 1. Start clean
git status # should show "nothing to commit"
# 2. Let AI work...
# (AI edits your files)
# 3. See what changed
git diff
# 4a. If you like the changes:
git add .
git commit -m "AI: Fixed grammar in chapter-3.md"
# 4b. If you don't like the changes:
git checkout -- .
Visual Tools
The command line works, but visual tools make Git easier:
| Tool | Platform | Notes |
|---|---|---|
| VS Code | All | Built-in Git panel |
| GitHub Desktop | Mac/Win | Beginner-friendly |
| GitKraken | All | Visual branches |
| Sourcetree | Mac/Win | Feature-rich |
Going Deeper
- Pro Git Book — free, comprehensive
- Git Immersion — hands-on tutorial
- Oh Shit, Git! — how to fix mistakes
Git will be covered hands-on in the Track Changes task.