Interview Prep/Git & GitHub/Branching and Merging Workflows

A mass reformat commit (Prettier, Black) ruined `git blame`. How do you recover useful blame?

IntermediateScenarioBranching and Merging Workflows
Answer

Situation read → Blame now attributes every line to the formatting commit.

What I'd do →

  1. Put the formatting commit SHA in .git-blame-ignore-revs at the repo root.
  2. Tell local Git to use it: git config blame.ignoreRevsFile .git-blame-ignore-revs.
  3. GitHub's blame view reads that file automatically, no setup needed.
  4. Ad hoc: git blame --ignore-rev <sha> file.py.

Why → Blame skips the listed commits and attributes lines to the previous meaningful change.

Interview tip → Do formatting changes as one isolated commit so the ignore list stays short.

All Git & GitHub questions Roadmap: Git & GitHub

More on Branching and Merging Workflows