Time: 15-20 minutes
Goal: Practice baby steps methodology with real Git workflow
Your brain can hold only 7±2 items in working memory simultaneously.
Quick experiment - try memorizing:
синий, стол, 12, марафон, бегать, мальчик, 56, число пи, красный, лук, изнашивается, 67, компьютер, окно, 89...
Notice how new words push out earlier ones? This is your cognitive limit in action.
Scenario: Task requires implementing 3 features
-
Approach A (Small steps): 3 sessions × 15 min = 45 minutes total
- Session 1: Feature 1 → commit
- Session 2: Feature 2 → commit
- Session 3: Feature 3 → commit
-
Approach B (All at once): 1 session = 2-3 hours
- Keep all 3 features in head simultaneously
- Context switching between features
- Confusion accumulates
- Time wasted untangling mistakes
Problem: AI creates working solution → then breaks it while "improving"
Solution: Stage files (git add) when anything works better, even slightly.
- Changes staged = safe checkpoint
- Can recover instantly if next change fails
- No time wasted recreating what worked
See module overview for full prerequisites list.
Create practice folder work/060-task - all course exercises go in work/[module-number]-task.
- Navigate to:
c:/workspace/hello-genai/work/(Windows) or~/workspace/hello-genai/work/(macOS/Linux) - Create folder:
060-task - Open in IDE terminal
Create a simple project to practice Git workflow. We'll use Python as example, but you can use any language.
Prompt for AI:
Create a simple Python calculator project with:
- calculator.py with add() and subtract() functions
- main.py that uses the calculator
- README.md with project description
Place these files in the current directory.
Expected structure:
work/060-task/
├── calculator.py
├── main.py
└── README.md
In terminal (make sure you're in work/060-task/ folder):
# Initialize Git
git init
# Check status
git statusWhat you see:
- Git created
.gitfolder (hidden) - All project files shown as "Untracked"
Prompt for AI:
I need to configure Git with my identity. My name is [Your Name] and email is [your@email.com].
What commands should I run?
AI will suggest:
git config --global user.name "Your Name"
git config --global user.email "your@email.com"Run those commands, then verify:
git config --global --listPrompt for AI:
Create .gitignore file for Python project. Include:
- Virtual environments
- Cache files
- Secrets/environment files
- IDE configuration
- My working files in temp/ directory
Review the generated .gitignore - make sure it includes .env and other secret files specific to your project.
Using IDE (RECOMMENDED):
- Open Source Control panel (Ctrl+Shift+G in VSCode)
- See all changed files
- Click
+next to each file to stage - Skip staging .gitignore for now (we'll use it as practice later)
Or via terminal:
git add calculator.py
git add main.py
git add README.mdCheck what's staged:
git statusCommit:
git commit -m "Initial calculator with add and subtract"✅ Checkpoint saved! You can now experiment safely.
Prompt for AI:
Add multiply() function to calculator.py
After AI adds the function:
- Test it - run the code, verify multiply works
- Stage immediately (via IDE or
git add calculator.py) - Don't commit yet - we're building up a feature
Why stage now?
- Works better than before (had no multiply)
- If next change breaks it, you can recover
- This is your safety checkpoint
Prompt for AI:
Update main.py to demonstrate multiply() function
After change:
- Test both files - calculator.py and main.py work together?
- Stage main.py (via IDE or
git add main.py) - Still don't commit - feature not complete yet
Prompt for AI:
Update README.md to document the multiply function
After change:
- Review README - looks good?
- Stage README.md
- NOW COMMIT - feature is complete
In IDE:
- Write commit message:
Add multiply function - Click commit button
Or terminal:
git commit -m "Add multiply function"✅ Feature complete! Took 3 small steps instead of one big confusing change.
Prompt for AI:
Add divide() function to calculator.py
But DON'T stage/commit yet!
Now deliberately break something:
Prompt for AI:
Refactor calculator.py to use class-based structure
This might break existing code. Check if main.py still works.
If broken:
-
Discard the refactoring (we didn't stage it - good!)
- IDE: Right-click file → Discard Changes
- Terminal:
git checkout -- calculator.py
-
Your divide() function is gone! But it was never staged, so no big loss.
This demonstrates: If you had staged divide() when it worked, you could recover it now.
Let's create some temporary test files:
Prompt for AI:
Create:
- test_calculator.py with unit tests
- debug.py with some debugging code I used to test things
- temp_notes.txt with my personal notes
Now stage everything:
git add .Before committing, ask AI:
Look at my staged files. Which are production-ready and which are scaffolding/temporary?
Staged files:
[paste output of: git status]
AI will categorize:
- ✅ Production: test_calculator.py (real tests), divide() function if you re-added it
- ❌ Scaffolding: debug.py (temporary), temp_notes.txt (personal notes)
Unstage scaffolding:
git reset HEAD debug.py
git reset HEAD temp_notes.txtAdd them to .gitignore:
Prompt for AI:
Update .gitignore to exclude debug.py and temp_notes.txt
Now commit the good stuff:
git add .gitignore
git commit -m "Add tests and update gitignore"If you want to backup to GitHub:
- Go to https://github.com/new
- Name:
git-baby-steps-practice - Public or Private (your choice)
- Do NOT initialize (we have local files already)
- Click "Create repository"
GitHub shows commands, but ask AI to be sure:
Prompt:
I created GitHub repo: https://github.com/[username]/git-baby-steps-practice
How do I connect my local repository and push?
AI will provide:
git remote add origin https://github.com/[username]/git-baby-steps-practice.git
git branch -M main
git push -u origin mainRun those commands.
✅ Your work is backed up! Now you can continue baby steps and push regularly.
Prompt for AI:
Add division by zero check to divide() function
Commit it:
git add calculator.py
git commit -m "Add division by zero check"Now break it:
Prompt for AI:
Rewrite entire calculator.py using advanced Python features
This probably broke everything. Test it.
Option A: Revert last commit
git revert HEADThis creates new commit that undoes the advanced rewrite.
Option B: Reset to previous commit
git log --oneline # Find commit hash before mistake
git reset --hard abc1234 # Replace abc1234 with actual hashThis removes the bad commit entirely.
✅ Recovered! This is why baby steps matter - easy to undo small changes.
-
Baby steps cycle:
Code → Test → Works better? → Stage → Continue ↓ Feature done? → Commit -
Staging = Safety checkpoint
- Stage when anything improves (even slightly)
- Don't wait for perfection
- Can recover if next change fails
-
Commit = Complete feature
- 5-15 minutes of work
- Tests pass
- No obvious bugs
-
AI is helper, not git operator
- AI generates code
- AI reviews files
- AI suggests commit messages
- YOU control git commands
Before Git:
- Hold all changes in head
- Hope nothing breaks
- Waste time untangling mistakes
With Git Baby Steps:
- Checkpoint every improvement
- Never lose more than 5-15 min of work
- Clear mind → focus on next small step
Use this workflow on your actual AI-assisted projects:
-
Start coding session:
git status- clean slate?git pull- get latest changes (if team project)
-
During coding:
- Works better? →
git add - Feature done? →
git commit - Major milestone? →
git push
- Works better? →
-
End of session:
- All good work committed?
- Nothing important left unstaged?
- Push to backup
Q: How small is "baby step"? A: If you can explain the change in one sentence - it's good size.
Q: Should I commit broken code? A: No! But you can stage broken code as checkpoint while debugging.
Q: Can AI commit for me? A: No! You control what goes into history. AI might commit secrets or junk.
Q: What if I forgot what I changed?
A: git diff shows unstaged changes. Review before staging.
Q: Should I commit every file AI creates? A: No! Ask AI to categorize production vs scaffolding. Only commit production.
"I staged the wrong file!"
git reset HEAD filename.py"I committed too early!"
git reset --soft HEAD~1 # Undo commit, keep changes staged"I pushed secrets to GitHub!"
# Remove from last commit
git rm --cached .env
git commit --amend -m "Remove secrets"
git push --force
# ⚠️ CRITICAL: Rotate all exposed secrets immediately!"Everything is broken, I want yesterday's version!"
git log --oneline # Find good commit
git reset --hard abc1234 # Go back to that commit# Daily cycle
git status # What changed?
git add filename # Stage improvements
git commit -m "descriptive message" # Save feature
git push # Backup to remote
# Safety operations
git diff # See unstaged changes
git diff --cached # See staged changes
git checkout -- filename # Discard unstaged changes
git reset HEAD filename # Unstage file
# Recovery
git log --oneline # See history
git revert HEAD # Undo last commit (safe)
git reset --soft HEAD~1 # Undo commit, keep changes
git reset --hard abc1234 # Go back to specific commit (DESTRUCTIVE)
# Information
git log --oneline -10 # Last 10 commitsFor detailed reference see: git-workflow.agent.md
Topics covered:
- Complete installation instructions
- .gitignore templates for all languages
- GitHub SSH setup
- Advanced recovery scenarios
If you completed Module 025 (downloaded course as ZIP) and want to receive updates via git pull instead of re-downloading ZIP files:
Follow the instructions: connect-course-to-github.agent.md
What this does:
- Creates backup of your current course folder
- Connects to official GitHub repository
- Syncs course files (your
work/folder stays safe - it's gitignored) - Enables
git pullfor future updates
When to do this:
- After completing this module (060) and feeling comfortable with Git
- Before starting modules 070+ to easily receive any course updates
- Only if you want automatic updates instead of manual ZIP downloads
Skip if:
- Still learning Git basics and don't want extra complexity
- Prefer manual control over course file updates
- Want to keep course completely offline