Skip to content

Instantly share code, notes, and snippets.

View zijievv's full-sized avatar

Zijie zijievv

View GitHub Profile
@zijievv
zijievv / Git-hook-for-swift-format.md
Last active September 4, 2025 10:51
Git pre-commit hook for swift-format

Git pre-commit hook for swift-format

Steps to create a git pre-commit hook for swift-format:

  1. Save the configuration file for swift-format, named .swift-format[^1], in the root directory of the project;
  2. 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;