Skip to content

Commit 8f08f72

Browse files
authored
Add git blame ignore file (#1745)
This commit adds a new file with the SHA1 of commits to ignore when running git blame. This is important because of the recent adoption of black and clang-format as our code formatting tool in #1630 we caused a large amount of code churn to change the code formatting. However, using the ignore file is a local opt-in feature for git and not something we can enable globally by default. To facilitate this a section is added to the bottom of the contributing guide to document how this file can be used.
1 parent 0366c51 commit 8f08f72

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

.git-blame-ignore-revs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0366c51c0e8d23ff0aa9a17eb4bc790c57feaf63

CONTRIBUTING.md

+25
Original file line numberDiff line numberDiff line change
@@ -1102,3 +1102,28 @@ Now we can run the Python interpreter and pass the arguments (the python file to
11021102
Target 0: (python) stopped.
11031103

11041104
After this, you can step through the code and continue with your debug session as always.
1105+
1106+
1107+
## Dealing with the git blame ignore list
1108+
1109+
In the qiskit-aer repository we maintain a list of commits for git blame to
1110+
ignore. This is mostly commits that are code style changes that don't change
1111+
the functionality but just change the code formatting (for example, when we
1112+
migrated to use black for code formatting). This file, `.git-blame-ignore-revs`
1113+
just contains a list of commit SHA1s you can tell git to ignore when using the
1114+
`git blame` command. This can be done one time with something like
1115+
1116+
```
1117+
git blame --ignore-revs-file .git-blame-ignore-revs qiskit/version.py
1118+
1119+
```
1120+
1121+
from the root of the repository. If you'd like to enable this by default you
1122+
can update your local repository's configuration with:
1123+
1124+
```
1125+
git config blame.ignoreRevsFile .git-blame-ignore-revs
1126+
```
1127+
1128+
which will update your local repositories configuration to use the ignore list
1129+
by default.

0 commit comments

Comments
 (0)