Files
git-workshop/module-02-history
2026-01-05 12:21:30 +01:00
..
2026-01-05 12:21:30 +01:00
2026-01-04 15:28:05 +01:00
2026-01-05 12:21:30 +01:00
2026-01-05 12:21:30 +01:00

Module 02: Viewing History

Learning Objectives

In this module, you will:

  • Understand commit history and how to navigate it
  • Use git log to view commit history with various formats
  • Use git show to view specific commit details
  • Use git diff to compare changes between commits
  • Understand commit hashes and references

Challenge

Setup

Run the setup script to create your challenge environment:

.\setup.ps1

This will create a challenge/ directory with a Git repository that already has some commit history.

Your Task

You'll explore an existing Git repository that contains multiple commits. Your goal is to use Git commands to discover information about the repository's history.

The setup script will create an answers.md file in the challenge directory with questions for you to answer. Fill in your answers directly in that file.

Suggested Approach:

  1. Navigate to the challenge directory: cd challenge
  2. Open answers.md to see the questions
  3. View the commit history: git log
  4. Try different log formats: git log --oneline, git log --stat
  5. View specific commits: git show <commit-hash>
  6. Compare commits: git diff <commit1> <commit2>
  7. Fill in your answers in answers.md

Important Notes:

  • You can use any Git commands you like to explore the repository
  • Fill in your answers directly in the answers.md file (there are placeholder sections for each answer)
  • Try different git log options to see which format you prefer
  • Commit hashes can be referenced by their full hash or just the first 7 characters

Key Concepts

  • Commit Hash: A unique identifier (SHA-1 hash) for each commit. You can use the full hash or just the first few characters.
  • Commit Message: A description of what changed in that commit, written by the author.
  • Commit History: The chronological record of all changes made to a repository.
  • HEAD: A pointer to the current commit you're working from.

Useful Commands

git log                      # View commit history
git log --oneline            # Compact one-line format
git log --stat               # Show files changed in each commit
git log --graph              # Show branch graph (more useful with branches)
git show <commit>            # View specific commit details
git show <commit>:<file>     # View a file from a specific commit
git diff <commit1> <commit2> # Compare two commits
git diff <commit>            # Compare commit with current working directory

Verification

Once you've filled in your answers in answers.md, verify your solution:

.\verify.ps1

The verification script will check that your answers contain the expected information.

Need to Start Over?

If you want to reset the challenge and start fresh:

.\reset.ps1

This will remove the challenge directory and run the setup script again, giving you a clean slate.