feat: add git blame section

This commit is contained in:
Bjarke Sporring
2026-01-07 20:22:53 +01:00
parent aefcfbe100
commit 30b878fc67
3 changed files with 79 additions and 15 deletions

View File

@@ -8,6 +8,7 @@ In this module, you will:
- Use `git show` to view specific commit details
- Use `git diff` to compare changes between commits
- Use `git diff --staged` to view changes ready to be committed
- Use `git blame` to find who made specific changes
- Understand commit hashes and references
- Discover how `git diff` reveals changes not visible in current files
@@ -30,6 +31,7 @@ You'll explore an existing Git repository that contains multiple commits. Your g
- Examining changes between specific commits
- Understanding staged changes
- **Finding a secret code hidden in the commit history!** (Only discoverable by using `git diff`)
- **Tracking down who made a suspicious code change** (Using `git blame`)
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.
@@ -43,7 +45,8 @@ The setup script will create an `answers.md` file in the challenge directory wit
6. Try different log formats: `git log --stat`, `git log --graph`
7. View specific commits: `git show <commit-hash>`
8. Compare specific commits: `git diff <commit1> <commit2> <file>`
9. Fill in your answers in `answers.md`
9. Use `git blame` to find who wrote specific lines: `git blame -e <file>`
10. Fill in your answers in `answers.md`
> **Important Notes:**
> - You can use any Git commands you like to explore the repository
@@ -204,6 +207,19 @@ git diff HEAD # Show all changes (staged + unstaged) vs last c
- `git diff HEAD` - See all your changes since the last commit
- `git diff <commit1> <commit2>` - Compare any two points in history
### Finding Who Changed What with git blame
```bash
git blame <file> # Show who last modified each line
git blame -e <file> # Show with email addresses
git blame -L 10,20 <file> # Blame specific line range (lines 10-20)
```
**When to use `git blame`:**
- Find who wrote a specific line of code
- Identify when a bug was introduced
- Understand the context/reason for a change by finding the author
## Verification
Once you've filled in your answers in `answers.md`, verify your solution: