Challenge - 5 Problems
Git Blame Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:00remaining
Identify the commit hash from git blame output
You run
What is the commit hash for the change on line 10?
git blame -L 10,10 README.md and see this output:e3a1b2c4 (Alice 2024-05-01 10:15:30 +0000 10) Fix typo in introduction
What is the commit hash for the change on line 10?
Attempts:
2 left
💡 Hint
The commit hash is the first part before the author name.
✗ Incorrect
The commit hash is the unique identifier for the commit and appears at the start of the git blame line.
🧠 Conceptual
intermediate0:45remaining
Purpose of git blame
What is the main purpose of the
git blame command?Attempts:
2 left
💡 Hint
Think about tracking changes line by line.
✗ Incorrect
git blame shows the author and commit info for each line in a file.❓ Troubleshoot
advanced1:30remaining
Why does git blame show wrong author for a line?
You notice
git blame shows an unexpected author for a line you recently changed. What could cause this?Attempts:
2 left
💡 Hint
Think about how git tracks line history when lines are copied.
✗ Incorrect
If a line is copied from another file or commit without changes, git blame attributes it to the original author.
🔀 Workflow
advanced2:00remaining
Using git blame to find when a bug was introduced
You want to find when a bug was introduced in a file. Which git command sequence helps you use
git blame effectively?Attempts:
2 left
💡 Hint
First find the commit that last changed the line, then inspect that commit.
✗ Incorrect
Using
git blame on the line shows the commit hash that last changed it. Then git show reveals details of that commit.✅ Best Practice
expert2:30remaining
Optimizing git blame output for large files
For a large file, running
git blame is slow. Which option improves performance without losing line history?Attempts:
2 left
💡 Hint
Skipping commits that only refactor code can speed up blame.
✗ Incorrect
Using
--ignore-rev skips commits that do not affect logic, improving blame speed and clarity.