Only run pre-commit on the changes (#7106)

Run pre-commit on all files may change files that are not part of the
current branch.
The updated script will only run pre-commit on the files that have been
changed in the current branch.

Signed-off-by: Hongwei <hongweichen@microsoft.com>
This commit is contained in:
Hongwei Chen
2025-03-04 08:15:03 -08:00
committed by GitHub
parent 776822fe21
commit e4c7931a4e

View File

@ -13,7 +13,7 @@ pre-commit install
Afterwards, our suite of formatting tests run automatically before each `git commit`. You
can also run these manually:
```bash
pre-commit run --all-files
pre-commit run --files $(git diff --name-only master)
```
If a formatting test fails, it will fix the modified code in place and abort
the `git commit`. After looking over the changes, you can `git add <modified files>`