Skip to content

Commit

Permalink
Add git blame ignore file (Qiskit#1745)
Browse files Browse the repository at this point in the history
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 Qiskit#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.
  • Loading branch information
mtreinish authored and hhorii committed Apr 7, 2023
1 parent ff5a1aa commit 070944e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ff5a1aa98e77173b09b1b83575118e71f719216c
25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -1102,3 +1102,28 @@ Now we can run the Python interpreter and pass the arguments (the python file to
Target 0: (python) stopped.

After this, you can step through the code and continue with your debug session as always.


## Dealing with the git blame ignore list

In the qiskit-aer repository we maintain a list of commits for git blame to
ignore. This is mostly commits that are code style changes that don't change
the functionality but just change the code formatting (for example, when we
migrated to use black for code formatting). This file, `.git-blame-ignore-revs`
just contains a list of commit SHA1s you can tell git to ignore when using the
`git blame` command. This can be done one time with something like

```
git blame --ignore-revs-file .git-blame-ignore-revs qiskit/version.py
```

from the root of the repository. If you'd like to enable this by default you
can update your local repository's configuration with:

```
git config blame.ignoreRevsFile .git-blame-ignore-revs
```

which will update your local repositories configuration to use the ignore list
by default.

0 comments on commit 070944e

Please sign in to comment.