After running any auto-format on a repository, git blame becomes almost useless because every line is “last touched” by the formatting commit.
Git has a built-in solution: tell git blame to ignore specific commits.
Create .git-blame-ignore-revs in root repo.
|
Enable it in your repo via git
|
Now when you run git blame, those commits will be skipped and you can see the real history again.
Notes
- Commit
.git-blame-ignore-revsinto your repo so GitHub (and other developers) can use the same ignore list. - GitHub also reads
.git-blame-ignore-revsautomatically in the web UI, so you’ll get the same “clean blame” there too.