| 1 |
# Ignore formatting commits with `git blame` |
| 2 |
|
| 3 |
Please follow these steps to avoid obscuring file history when making commits that are |
| 4 |
strictly formatting/style changes (e.g., after running a new version of black or running |
| 5 |
pyupgrade after dropping an old Python version). |
| 6 |
|
| 7 |
1. Create a new branch. |
| 8 |
2. Make any linting and formatting rules needed; either in the `pre-commit.config.yaml` |
| 9 |
or in the `pyproject.toml` file. |
| 10 |
3. Commit your changes with the `--no-verify` flag to skip the pre-commit hooks. |
| 11 |
4. Run the pre-commit hooks manually with `tox run -e lint` or `pre-commit run --all-files`. |
| 12 |
5. Commit the linting and formatting changes. |
| 13 |
6. Open a PR with these changes. |
| 14 |
|
| 15 |
```{important} |
| 16 |
This PR **must** be rebase-merged -- instead of the default squash-merge we |
| 17 |
currently follow -- so a repository admin needs to enable this setting in the |
| 18 |
repository temporarily. |
| 19 |
|
| 20 |
``` |
| 21 |
|
| 22 |
7. Open a new PR adding the commit hashes of the formatting commits to the `.git-blame-ignore-revs` file. |
| 23 |
|
| 24 |
For more details, see: |
| 25 |
|
| 26 |
- <https://git-scm.com/docs/git-config#Documentation/git-config.txt-blameignoreRevsFile> |
| 27 |
- <https://github.com/pydata/pydata-sphinx-theme/pull/713> |