Summary - Blame
- Git course
- Advanced
- Lesson 12/56
- 5 min
Combine blame options to investigate line ownership.
Summary: Blame options
git blame displays the latest modifications to file lines with commit and author information. You can inspect the commit ID with git show to understand the context of the change. In large files, use the -L option to focus on a specific line range.
git blame -L 15,30 app.js
git show a12bc34Blame identifies the commit that last modified a line; this is not always the commit that first introduced it.
Practice Combine blame options
Inspect lines 100 through 115 of src/api.js. Then display the change details for the example commit ID f82ab10.
Starter code
# İlgili satır aralığının yazarlarını incele
# Commit ayrıntılarını gösterSample solution
git blame -L 100,115 src/api.js
git show f82ab10Expected output
Blame information displayed for lines 100-115 of src/api.js. Commit f82ab10 details displayed.
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 You want to see the author and commit information for only lines 60 through 75 of a file. Which command option is required?
- --author
- --since
- -L Correct answer
- --stat
Explanation: -L restricts blame output to a specific line range.
2 Inspect authors and a line range together
git blame ____ src/dashboard.js
git blame -L 70,90 src/dashboard.js
Explanation: Use the -L option before the file name to specify the line range.
3 Blame investigation workflow
| Term | Meaning |
|---|---|
git blame |
Identifies the latest line modification |
Yazar bilgisi |
Shows the person who made the change |
-L |
Limits inspection to a line range |
git show |
Displays the relevant commit details |