Steps to create a git pre-commit hook for swift-format
:
- Save the configuration file for
swift-format
, named.swift-format
[^1], in the root directory of the project; - Create a new file named
pre-commit
in the path/<PATH_TO_YOUR_PROJECT>/.git/hooks
, and give it executable permissions:
cd /<PATH_TO_YOUR_PROJECT>/.git/hooks/; touch pre-commit; chmod +x pre-commit;