From fb17c0fcb990f1e3c50a2d1808cd22a2d0548de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=9D=B0=E5=8F=8B=20Jieyou=20Xu=20=28Joe=29?= <39484203+jieyouxu@users.noreply.github.com> Date: Mon, 23 Sep 2024 16:40:39 +0800 Subject: [PATCH] Describe `.git-blame-ignore-rev` --- src/git.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/git.md b/src/git.md index b716ccd44..90dbc3fb1 100644 --- a/src/git.md +++ b/src/git.md @@ -597,6 +597,19 @@ $ git submodule foreach git reset --hard and then try `git submodule update` again. +## Ignoring commits during `git blame` + +Some commits contain large reformatting changes that don't otherwise change functionality. They can +be instructed to be ignored by `git blame` through +[`.git-blame-ignore-revs`](https://github.com/rust-lang/rust/blob/master/.git-blame-ignore-revs): + +1. Configure `git blame` to use `.git-blame-ignore-revs` as the list of commits to ignore: `git + config blame.ignorerevsfile .git-blame-ignore-revs` +2. Add suitable commits that you wish to be ignored by `git blame`. + +Please include a comment for the commit that you add to `.git-blame-ignore-revs` so people can +easily figure out *why* a commit is ignored. + [Git submodules]: https://git-scm.com/book/en/v2/Git-Tools-Submodules [`rust-lang/llvm-project`]: https://github.com/rust-lang/llvm-project [llvm-update]: https://github.com/rust-lang/rust/pull/99464/files