When reviewing code, it's often frustrating when 'git blame' or commit messages don't explain the reasoning behind a change. What are your go-to methods for finding out why a change was made? Do you check old pull requests, ask team members, or do you just move on and hope for the best?
4 Answers
Always check the commit hash! You can look at the commit itself and nearby commits to get a better idea. And like others said, don't hesitate to just ask whoever made the change.
I always hope there's a ticket number in the commit message. If not, a quick chat with teammates usually helps clarify things!
Sometimes you just have to call out the previous coder and fix their mistakes yourself. It’s part of the job, right?
The quickest route is to ask the person who made the change if they're available. If they've left, you can look at the differences before and after the change. Most adjustments fall under a few reasons, like bug fixes, making things look better, or performance improvements. Just try to grasp the overall purpose from the changes.
Yeah, we've been pretty good about adding ticket numbers in the last few years. It makes tracing back through version history so much simpler!