Git Fundamentals with AI Assistance

Master version control with Claude as your guide through Git's essential concepts

40 min
Beginner
75% completion rate
50% popularity
git
version-control
claude-code
ai-assistance
development-workflow

Module 2: Git Fundamentals with AI Assistance

Overview

Git can be intimidating, but with Claude as your guide, you'll master version control naturally. This module transforms Git from a mysterious tool into your project's time machine—letting you save progress, experiment freely, and collaborate confidently.

What You'll Learn

  • Git's core concepts explained simply
  • Repository initialization and configuration
  • Staging and committing changes
  • Using Claude to demystify Git operations
  • Building good version control habits

Prerequisites

  • Completed Module 1 (Claude Code installed)
  • Website project created in Module 1
  • 40 minutes for hands-on practice
  • Willingness to make mistakes (Git forgives!)

Why Git Matters

Your Project's Safety Net

Imagine working on your website and:

  • Accidentally deleting important code
  • Breaking something that was working
  • Wanting to try a risky change
  • Needing to collaborate with others

Without Git: Panic, lost work, fear of experimentation With Git: Confidence, safety, freedom to explore

Git + Claude = Learning Accelerator

Traditional Git learning:

  • Memorize cryptic commands
  • Hope you understand concepts
  • Fear of making mistakes
  • Confusion about what happened

With Claude's assistance:

  • Natural language explanations
  • Real-time guidance
  • Safe experimentation
  • Clear understanding

Git Mental Model

Think of Git as...

A magical filing cabinet where:

  • Each drawer is a "commit" (snapshot)
  • You can open any drawer to see that moment
  • Drawers never disappear
  • You can create alternate timelines
  • Everything is recoverable

The Three Stages

Working Directory → Staging Area → Repository
     (Edit)         (Prepare)      (Save)
  1. Working Directory: Your actual files
  2. Staging Area: Changes ready to save
  3. Repository: Permanent snapshots

Setting Up Git with Claude

Initial Configuration

In your project directory:

cd my-ai-website
claude

Ask Claude:

⚡ Help me set up Git for this project. Check if Git is installed, 
configure my name and email, and initialize a repository.

Claude will:

  • Check Git installation
  • Guide configuration
  • Initialize repository
  • Explain each step

Understanding .git Directory

⚡ What is the .git directory that was just created? 
Is it safe to look inside?

Claude explains the magic behind the scenes!


Your First Commit

The Commit Process

Let Claude guide you:

Show me the current Git status and help me make my first commit. 
Explain what each step does.

You'll see:

  1. Status check (what's changed)
  2. Adding files (staging)
  3. Committing (saving snapshot)
  4. Success confirmation

Commit Messages Matter

⚡ What makes a good commit message? Show me examples for 
committing a new website.

Good commit messages:

  • "Add homepage with navigation and hero section"
  • "Fix responsive menu on mobile devices"
  • "Update contact form validation"

Not helpful:

  • "Fixed stuff"
  • "Changes"
  • "asdfasdf"

Working with Changes

Making and Tracking Edits

Let's modify your website:

⚡ Add a "Latest News" section to the homepage with 3 news items. 
After you're done, show me the Git diff.

Claude will:

  1. Edit your files
  2. Show what changed
  3. Explain the diff output
  4. Guide your next commit

The Power of Git Diff

⚡ Explain what git diff is showing me. What do the + and - 
symbols mean? How do I read this?

Understanding diffs helps you:

  • Review changes before committing
  • Spot unintended modifications
  • Understand what teammates changed
  • Debug issues

Git Workflows with Claude

The Daily Workflow

I want to add a photo gallery to my site. Walk me through 
the Git workflow I should follow.

Claude guides you through:

  1. Check current status
  2. Create feature
  3. Review changes
  4. Stage relevant files
  5. Commit with clear message
  6. Verify success

Selective Staging

I changed multiple files but want to commit them separately. 
Show me how to stage specific files.

Learn to:

  • Stage individual files
  • Create logical commits
  • Keep history clean
  • Make changes traceable

Common Git Scenarios

Scenario 1: Oops, Wrong Commit Message

I just committed but made a typo in my message. 
How do I fix it?

Claude shows safe correction methods.

Scenario 2: Forgot to Add a File

I committed but forgot to include a CSS file. 
What's the best way to add it?

Learn to amend commits properly.

Scenario 3: Need to See History

⚡ Show me my commit history in a nice format. 
Explain what I'm looking at.

Understand your project's timeline.


Git Best Practices

Commit Early, Commit Often

⚡ Why do people say "commit early and often"? 
Show me a good commit frequency for my project.

Benefits:

  • Never lose much work
  • Easy to find when bugs appeared
  • Clear project evolution
  • Simpler collaboration

Logical Commits

⚡ Help me organize these changes into logical commits:
- Fixed navigation menu
- Added footer
- Updated colors throughout site
- Fixed typos in about page

Claude teaches commit organization.

.gitignore Essentials

⚡ Create a .gitignore file for my website project. 
Explain what should be ignored and why.

Learn what not to track:

  • System files
  • Editor settings
  • Temporary files
  • Sensitive information

Hands-On Exercises

Exercise 1: Feature Addition Workflow

Practice the complete workflow:

⚡ Guide me through adding a testimonials section:
1. Check current status
2. Create the feature
3. Review changes
4. Make a meaningful commit
5. Verify the commit

Exercise 2: Multiple Commits

Learn selective committing:

⚡ I want to:
1. Fix the mobile menu
2. Add social media links
3. Update the color scheme

Help me make three separate, logical commits.

Exercise 3: Exploring History

Understand your project's evolution:

Show me:
1. All commits with stats
2. What changed in each commit
3. Who made each change (it's all me!)
4. How to see an old version

Understanding Git's Benefits

Freedom to Experiment

With Git, you can:

  • Try risky changes (revert if needed)
  • Keep multiple versions
  • Compare approaches
  • Never lose working code

Clear Project History

Git provides:

  • When changes were made
  • Why changes were made (commit messages)
  • What exactly changed
  • Who made changes

Collaboration Foundation

Even working alone, you're preparing for:

  • Sharing your code
  • Getting help from others
  • Contributing to projects
  • Professional development

Troubleshooting with Claude

Common Issues

"Git says I have changes but I didn't change anything"

⚡ Git shows modified files but I didn't edit them. 
What's happening and how do I investigate?

"I'm scared to commit"

⚡ I'm worried about messing up my Git history. 
What's the worst that can happen and how do I fix mistakes?

"Git commands are confusing"

⚡ Can you create a cheat sheet of the Git commands 
I'll use most often with simple explanations?

Building Git Confidence

Practice Makes Perfect

The more you use Git:

  • Commands become natural
  • Concepts click into place
  • Fear disappears
  • Productivity soars

Claude as Your Git Mentor

Whenever stuck:

I'm trying to [GOAL]. What Git commands do I need?

Or:

⚡ Git gave me this error: [ERROR]. What does it mean and how do I fix it?

Checkpoint Task

Your Mission

Create a complete Git workflow for your website:

  1. Initialize and Configure

    • Set up Git in your project
    • Configure your identity
    • Create .gitignore
    • Make initial commit
  2. Feature Development

    • Add new section to your site
    • Review changes with diff
    • Commit with descriptive message
    • Check commit history
  3. Multiple Changes

    • Make 3 different improvements
    • Stage and commit separately
    • Write clear commit messages
    • Review your history
  4. Practice Recovery

    • Make a "mistake" change
    • Use Git to see what changed
    • Revert the change
    • Verify everything works
  5. Git Understanding

    • Ask Claude to explain your Git log
    • Understand each commit's purpose
    • Feel confident with basics

Success Criteria

  • ✅ Git repository initialized
  • ✅ At least 5 meaningful commits
  • ✅ Clear commit messages
  • ✅ Can view and understand history
  • ✅ Comfortable with basic Git workflow

Git Command Reference

Essential Commands

# Check status
git status

# Stage changes
git add filename.html
git add .

# Commit changes
git commit -m "Your message"

# View history
git log --oneline
git log --stat

# See changes
git diff
git diff --staged

# Undo/fix
git commit --amend
git restore filename

Next Steps

You've conquered Git basics! Module 3 will show you:

  • Connecting to GitHub
  • Pushing your code online
  • GitHub CLI mastery
  • Collaboration basics

Your local Git repository is ready for the cloud!

Preparation for Module 3

  1. Complete all Git exercises
  2. Have at least 5 commits
  3. Feel comfortable with basic commands
  4. Ready to go online!

Ready to share your code with the world? Module 3 introduces GitHub!

Your Progress

Not started