šŸŽ“
1 / 12

102 — Inspecting Changes and History

Master Git's powerful inspection tools. Learn to view differences between files, explore commit history with advanced filters, and track changes line by line.

Learning Objectives

1
Use git diff to compare changes in various contexts
2
Master advanced git log options and filters
3
Inspect specific commits with git show
4
Track line origins with git blame
Step 1

Create a practice repository

Set up a repository with multiple commits to practice inspection commands.

Commands to Run

mkdir -p ~/git-practice/lesson-102
cd ~/git-practice/lesson-102
git init
echo "# Project Documentation" > README.md
git add README.md
git commit -m "Initial commit: Add README"
echo "## Installation" >> README.md
echo "npm install" >> README.md
git add README.md
git commit -m "Add installation instructions"
echo "function hello() { return 'Hello'; }" > app.js
git add app.js
git commit -m "Add hello function"

What This Does

We're creating a repository with multiple commits and files. This gives us a realistic history to inspect using various Git commands.

Expected Outcome

You have a repository with 3 commits and 2 files (README.md and app.js).

Pro Tips

  • 1
    Run git log --oneline to verify you have 3 commits

All Steps (0 / 12 completed)