From 0c0d04888f26313a8d2db3f673c127578a46bb57 Mon Sep 17 00:00:00 2001 From: James McBride Date: Mon, 6 Feb 2023 09:42:03 -0800 Subject: [PATCH] Exclude major black only commits from git blame (#2780) * Exclude major black only commits from git blame As more projects I've used have adopted `black` for styling, one minor annoyance has been the impact that `black` commits that impact many lines of code have on the usability of `git blame`. A co-worker introduced me to the changes proposed here, which make the blame more usable. As of spring last year, github now looks at .git-blame-ignore-devs by default (https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view), so the blame view in github will use these commits. devs who want their local `git blame` will need the step added to the CONTRIBUTING.md file. * Update .git-blame-ignore-revs Co-authored-by: Matt Richards <45483497+m-richards@users.noreply.github.com> --------- Co-authored-by: Matt Richards <45483497+m-richards@users.noreply.github.com> --- .git-blame-ignore-revs | 8 ++++++++ CONTRIBUTING.md | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..932c2ca --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,8 @@ +# black-ification of code +479b6e706293ff1a484e4e121682f3a105a53aa9 +7bc3166cfecdd120b544701cff5e37b4482cbbb5 +f4b749d148f0eb13e7e92fbbf7e2eae79de2543a +373ac8bf731db1002e09859587c475a5f56c4e8b +50c59d395bc539eb411f9a5c6cdf04d37510060a +5dc982edbfc2633cd2c7a22ebd314d1b9b810a9a +44dba4fde90e8010ea6c71c6cf51b34413440177 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9a2562a..ec89552 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -69,4 +69,8 @@ Style Then `black` and `flake8` will be run automatically each time you commit changes. You can skip these checks with `git commit - --no-verify`. + --no-verify`. You can also configure your local git clone to have + `git blame` ignore the commits that introduced large formatting-only + changes with: + + $ git config blame.ignoreRevsFile .git-blame-ignore-revs