This directory contains Git hooks for the ExecuTorch repository.
The pre-commit hook automatically updates the PyTorch commit pin in .ci/docker/ci_commit_pins/pytorch.txt whenever torch_pin.py is modified.
- When you commit changes to
torch_pin.py, the hook detects the change - It parses the
NIGHTLY_VERSIONfield (e.g.,dev20251004) - Converts it to a date string (e.g.,
2025-10-04) - Fetches the corresponding commit hash from the PyTorch nightly branch at https://github.com/pytorch/pytorch/tree/nightly
- Updates
.ci/docker/ci_commit_pins/pytorch.txtwith the new commit hash - Automatically stages the updated file for commit
To install the Git hooks, run:
.githooks/install.shThis will copy the pre-commit hook to .git/hooks/ and make it executable.
You can also run the update script manually at any time:
python .github/scripts/update_pytorch_pin.pyTo remove the pre-commit hook:
rm .git/hooks/pre-commitIf the hook fails during a commit:
- 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) - Make sure the corresponding nightly release exists in the PyTorch nightly branch
You can run the script manually to see detailed error messages:
python .github/scripts/update_pytorch_pin.py