Hacker News new | ask | show | jobs
by orthoxerox 453 days ago
Isn't that what git bisect is for?
2 comments

Sometimes you don't know which commit actually caused the problem.

e.g., you realize that something broke A/B test logic on Friday. Sure, there are Jira tickets, but that's slow and annoying to dig through. There are commit messages, but things get squashed, etc. Plus, if you work in a monorepo with about 60 PRs a day, it's hard to know if it was your code or an associated library someone touched.

That's exactly when git bisect helps. It quickly narrows down which commit introduced the bug when you don't know where to start looking. Once bisect identifies the problematic commit, you can then use git blame (if needed) to see who made those specific changes.

Edit: Cleaned up what I was saying to hopefully avoid confusion.

I'm not quite sure what you're saying, but blame just tells you the last person and commit to change a line.

If you want to know which commit actually caused a problem you would use bisect. That may be what you're saying, but it sounded a bit like you are saying blame is better for tracking the culprit commit.

Bisect is for finding behavior changes in O(log n) operations. Blame is for finding the last change to a line in one operation.