Plain git blame file.ts is fine for tiny files. On a 2000-line file it's noise. Use the surgical flags.
Range blame — only the lines you care about:
git blame -L 120,150 src/auth.ts
git blame -L /^function login/,/^}/ src/auth.ts # by regex
The regex form follows the function from its signature to the closing brace — Git infers the range.
Ignore whitespace — a reformat shouldn't claim authorship of every line:
git blame -w src/auth.ts
This makes -w blame the commit that wrote the actual content, not the one that re-indented it.
Ignore known refactor commits — the killer feature. Your team did a big Prettier reformat; that commit now "owns" half the file. You can tell blame to look past it:
git blame --ignore-rev <reformat-sha> src/auth.ts
For a permanent solution, list those commits in a file and configure Git:
echo "abc123" >> .git-blame-ignore-revs
git config blame.ignoreRevsFile .git-blame-ignore-revs
Now every git blame automatically skips those revs. GitHub and most IDEs respect this file too.
Follow movement and copy (-M / -C):
git blame -M -C src/auth.ts
-M detects lines moved within the file; -C detects lines copied from another file in the same commit. Excellent for "who originally wrote this — before the refactor that moved it here?"
Combine them: git blame -w -M -C --ignore-revs-file .git-blame-ignore-revs -L 100,200 file.ts. That's the actual blame you usually want.