by pdw · 5y ago · 0 comments
If have commits like this, add the ids to a file `ignorerevs`, and then tell git about it:
git config --local blame.ignoreRevsFile ignorerevs
Then at least `git blame` will still give useful results. (This is a relatively new git feature, added a year or two ago.)https://stackoverflow.com/questions/58042532/how-can-i-clang...
But wouldn’t the standard -w be enough to ignore most of this commit.
But I used ignoreRevs in repositories that messed up their history by using an automatic indenter with atrocious settings.
Hm, especially for the case of blaming (mostly to figure out why something was done a certain way) I frequently happen upon 10+ year old commits. This happens both in open-source projects, as well as at work (where we don't use git, but the same concepts apply).
Still need to specify the file yourself, so hopefully someone can point out the missing magic to have git pull in .git-blame-ignore-revs on its own.
[0] https://git-scm.com/docs/git-config#Documentation/git-config...
banana_giraffe was asking for a way to set it up automatically so users don't have to do anything.
That says to list all the annoying commits in a file, then use a new-ish (Git version 2.23) Git feature to ignore all those commits when doing git blame.
Notice that one of the comments in that article says how to get everyone to use that ignore file, when using GitLens with VSCode.
The real problem here is that “git blame” is a garbage tool. Perforce has “timelapse view” that is radically better than any historical view I’ve seen in Git/Hg.
With respect to this issue, git just needs to suck less.
My company has a web tool for browsing the repo that allows this. It’s still inferior to Perforce timelapse view. But it’s not a hard blocker.
git blame WS_COMMIT^ -- FILE
You’ll need to change the file name, though, if it’s been renamed since the whitespace change.