mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-07-21 00:23:30 -05:00
- book/tools/git-hooks/pre-commit: runs pre-commit run --all-files - setup.sh: one-time config (git config core.hooksPath) - Ensures local commits pass same checks as CI
27 lines
607 B
Markdown
27 lines
607 B
Markdown
# MLSysBook Git Hooks
|
|
|
|
Custom hooks that run pre-commit on **all files** before each commit, matching CI behavior.
|
|
|
|
## Setup (one-time)
|
|
|
|
From the repo root:
|
|
|
|
```bash
|
|
./book/tools/git-hooks/setup.sh
|
|
```
|
|
|
|
Or manually: `git config core.hooksPath book/tools/git-hooks`
|
|
|
|
## What it does
|
|
|
|
- **pre-commit**: Runs `pre-commit run --all-files` before every commit.
|
|
- Ensures local commits pass the same checks as CI.
|
|
- If any hook modifies files, the commit is aborted; stage the changes and commit again.
|
|
|
|
## Revert to default hooks
|
|
|
|
```bash
|
|
git config --unset core.hooksPath
|
|
pre-commit install --install-hooks
|
|
```
|