TIL: When you are making large refactors to your code (e.g. when introducing a code formatter like black
) and you don’t want them to muddle up your git blame
, you can create an ignore file for specific revisions! No more false attribution and having to manually look up the change history for specific lines to find out the real source of truth!
Command for setting the .git-blame-ignore-revs
file as your ignore file.
git config blame.ignoreRevsFile .git-blame-ignore-revs
The format for this file is a single git revision hash per line. This also automatically works with most IDEs I’ve tested (a restart might be required), as they use git blame
under the hood.