This directory contains Git hooks for the ExecuTorch repository. It is used as
core.hooksPath, so git looks here instead of .git/hooks/.
Runs on every commit:
- torch_pin sync — when
torch_pin.pyis staged, updates the PyTorch commit pin in.ci/docker/ci_commit_pins/pytorch.txtand syncs grafted c10 files. - lintrunner — runs
lintrunner -a --revision HEAD^ --skip MYPYon changed files. Auto-fixes formatting and blocks on lint errors. Soft-fails if lintrunner is not installed. Runslintrunner initautomatically when.lintrunner.tomlchanges.
Delegates to .git/hooks/pre-push if one exists. This allows backend-specific
pre-push hooks (e.g., ARM's license and commit message checks) to work alongside
the repo-wide hooks.
Hooks are installed automatically by ./install_executorch.sh.
To install manually:
git config core.hooksPath .githooksARM contributors should additionally install the ARM-specific pre-push hook:
cp backends/arm/scripts/pre-push .git/hooks/To skip hooks for a single commit or push:
git commit --no-verify
git push --no-verifyIf the torch_pin hook fails:
- Check that Python 3 is available in your PATH
- Ensure you have internet connectivity to fetch commits from GitHub
- Verify that the
NIGHTLY_VERSIONintorch_pin.pyis in the correct format (devYYYYMMDD)
If lintrunner fails:
- Run
lintrunner initto install linter tools - Check that your virtual environment is activated