Git
The Line git blame Can't See
git blame tells you who touched a line last. For a line that's already been deleted, it has no answer at all.
You're reading a background job that credits payments, and one line near the top makes you stop. You want to know why it's there, so you do what everyone does. You run git blame.
The commit is from 2024, with the message "Rescue upload payment info job to execute multiple times which results into duplicate payment entries". You open it expecting to learn about your line. It tells you nothing. That commit wrapped the whole job in a begin/rescue block, and your line moved two spaces to the right.
The line itself is three years older. blame didn't lie. It answered a question you didn't ask. And that's the mild version of the problem. The serious version is when the line you need isn't in the file any more.
In this post
- 01What blame actually answers
- 02git log -S: when did this text start or stop existing?
- 03Finding a line that's gone
- 04When one change is two commits
- 05Which question are you asking?
- 06Try it on your own repository
- Git
- Developer Tools
- Debugging
- Programming
- Software Engineering