Skip to content

Commit f15605d

Browse files
Add git-blame-ignore-revs to hide bot commits - ornl-next (#39153)
Add git-blame-ignore-revs to hide bot commits This is a feature of git/github so git blame will ignore commits by bots or changes in formatting tool configuration
1 parent 9b2268b commit f15605d

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

.git-blame-ignore-revs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# The refspecs listed in this file are ignored by `git blame` when git is configured correctly.
2+
# The refspecs must be listed in commit order from oldest to newest.
3+
#
4+
# MOST OF THE COMMITS LISTED ARE BY BOTS
5+
#
6+
# github does this automatically https://docs.github.com/en/repositories/working-with-files/using-files/viewing-and-understanding-files#ignore-commits-in-the-blame-view
7+
#
8+
# To configure it locally, run
9+
# git config blame.ignoreRevsFile .git-blame-ignore-revs
10+
# Or add it as an option
11+
# git blame --ignore-revs-file .git-blame-ignore-revs
12+
13+
dccacdbddbc28f43a4ab9d1b63caf2fda71b1688
14+
9485437150f800515afbf15ab6ef05108714a0eb
15+
a90b115e443e27eb187aba3cd794eee591079401

dev-docs/source/GitWorkflow.rst

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,27 @@ pushed to GitHub, please follow the convention of
6868
what the branch is for (issue number) and quickly know what is being
6969
done there (short description).
7070

71+
Git Blame
72+
---------
73+
74+
The refspecs listed in this file are ignored by ``git blame`` when git is configured correctly.
75+
This is mostly used to hide commits that are created by bots (e.g. formatting)
76+
The refspecs must be listed in commit order from oldest to newest.
77+
Github does this automatically in the `blame view of a file <https://docs.github.com/en/repositories/working-with-files/using-files/viewing-and-understanding-files#ignore-commits-in-the-blame-view>`_
78+
79+
To configure it locally (examples assume you are in the root of your local clone), add it as an option to git blame
80+
81+
.. code-block:: sh
82+
83+
git blame --ignore-revs-file .git-blame-ignore-revs
84+
85+
or configure your local git instance
86+
87+
.. code-block:: sh
88+
89+
git config blame.ignoreRevsFile .git-blame-ignore-revs
90+
91+
7192
.. _GitWorkflowPullRequests:
7293

7394
Pull Requests
@@ -143,8 +164,7 @@ The reasons a pull request may be flagged up currently are:
143164
- The developer has yet to act on comments left in a review
144165

145166

146-
(code for the bot is currently `here
147-
<https://github.com/DanNixon/mantid_pr_bot>`__)
167+
(code for the bot is currently `here <https://github.com/DanNixon/mantid_pr_bot>`__)
148168

149169
Code Freeze
150170
-----------
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Added file ``.git-blame-ignore-revs`` to ignore particular revisions (e.g. by bots) in ``git blame`` listings. See :ref:`GitWorkflow` page for more details.

0 commit comments

Comments
 (0)