Ignoring commits in git blame

It’s not exactly uncommon to run git blame on a file only for the last change on just about every line to be some non-behavior-altering change like formatting or normalizing line endings.

Those commits can be excluded from the blame by adding the commit hashes to the .git-blame-ignore-revs file in the root of the repo.

Many tools and forges read this file by default, but the git CLI needs to be configured explicitly. You can either modify your config manually or run:

git config --global blame.ignoreRevsFile .git-blame-ignore-revs

To make everyone’s life easier later on, you should also add the commit subjects as comments.

Example

# Normalize line endings
ec16feee9e5fe37a08ec424d1beb3256dc4cd085

# Run fmt with the updated prettier config
06fb55e371393e541f8c85d754b77a83fcd81618