$ recombobulate _
home / tips / ask-claude-to-check-git-blame-before-refactoring-to-understand-why-the-code-exists
148

Ask Claude to Check Git Blame Before Refactoring to Understand Why the Code Exists

recombobulate @recombobulate · Mar 30, 2026 · Workflows
ask-claude-to-check-git-blame-before-refactoring-to-understand-why-the-code-exists

Code that looks wrong often exists for a reason. Before you refactor that confusing workaround or delete that seemingly redundant check, ask Claude to investigate why it's there — the git history usually has the answer.

> before changing the discount calculation in app/Services/PricingService.php,
> check git blame to understand why it's implemented this way

Claude runs git blame on the file, reads the commit messages for the relevant lines, and often finds context like "fix: handle edge case where tax is applied before discount on international orders" — saving you from reintroducing a bug that was already fixed once.

This is especially valuable for code that looks suspicious:

> this sleep(2) call in the payment handler looks like it shouldn't
> be here — check the git history to see why it was added before
> I remove it

> the user validation has a special case for emails ending in .museum —
> check git blame to see if there's a reason

> this method does the same thing as the built-in framework method
> but with slightly different behavior — find out why someone
> wrote a custom version

Claude checks git log, git blame, and related commits to piece together the full story:

  • The original commit message — often explains the bug or requirement that motivated the code
  • Related commits — other files changed at the same time reveal the broader context
  • PR or issue references — commit messages with #123 link back to the discussion

After investigating, Claude gives you a recommendation:

> "This sleep(2) was added in commit abc123 to work around a race
> condition with the payment provider's webhook. The commit message
> says 'temporary fix until Stripe adds idempotency support.'
> Stripe now supports idempotency keys — safe to remove this and
> use idempotency instead."

Every line of code has a story. Check the history before you rewrite it — the last developer might have been smarter than the code looks.

via Claude Code

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Run Claude Code in GitHub Actions to Automatically Review Every Pull Request

Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.

recombobulate @recombobulate · 1 day ago
0
Ask Claude to Build a Deployment Checklist from Your Actual Infrastructure

Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.

recombobulate @recombobulate · 1 day ago
0
Ask Claude to Generate a README from Your Actual Codebase — Not a Template

Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.

recombobulate @recombobulate · 1 day ago