.git-blame-ignore-revs Generator
List of commit hashes for Git to ignore in blame (mass formatters: prettier, black, eslint --fix). Useful for large refactors.
Arquivo .git-blame-ignore-revs:
—
Habilite com: git config blame.ignoreRevsFile .git-blame-ignore-revs
Keeping the formatting commit out of blame
Running a formatter across the whole project solves one problem and creates another: blame starts pointing at the formatting commit instead of at whoever wrote the line. A whole file apparently authored by someone who merely ran Prettier is pure noise, and the history loses exactly the information blame exists to provide.
Git solves this with a file listing the commits to ignore. Paste the hashes, one per line, optionally followed by a description — the page assembles the file with the description becoming a comment above each hash, which is the usual convention. Save it as .git-blame-ignore-revs in the repository root.
One step is missing that almost everyone forgets: the file is not used automatically. You have to point at it in the config with git config blame.ignoreRevsFile .git-blame-ignore-revs — and every person on the team has to run that in their own copy, because configuration does not travel with the repository. It is worth putting the command in the README or the setup script. GitHub and GitLab, on the other hand, honour the file automatically when it exists.
Frequently asked questions
Do I need the full hash?
What happens if a commit does not exist?
Can I use it for any commit I want hidden?
Related Tools
.gitignore Generator
Generate a .gitignore by combining language/IDE templates — Node, Python, Java, Go, Rust, .DS_Store, JetBrains, VSCode etc. Everything in your browser.
.mailmap (Git) Generator
Map inconsistent names and emails to a single author in Git, improving stats and shortlog. Official format.
Git Aliases Generator
Useful git aliases (st, co, br, lg, undo, save, wip, amend, hist) ready to paste into .gitconfig.
Git Cheatsheet
Searchable list of the most-used git commands — config, commit, branch, merge, rebase, stash, log, remote, reset. With copyable examples. Everything in your browser.
.gitattributes Generator
Generate .gitattributes to normalize line endings, mark binaries, configure diff and override GitHub linguist language stats.
Git Merge Conflict Resolver
Splits a file with Git conflict markers into ours and theirs versions, lets you pick a side per hunk and outputs the resolved file.