## Pre-commit Hook (`.git/hooks/pre-commit`) - Runs `cargo +nightly fmt` before every commit - Checks if the formatting made any changes - If changes were made, it prevents the commit and asks you to add the changes and commit again - If no changes were needed, the commit proceeds normally ## Pre-push Hook (`.git/hooks/pre-push`) - Runs `cargo +nightly fmt` before every push - Checks if the formatting made any changes - If changes were made, it prevents the push and asks you to commit the changes and push again - If no changes were needed, the push proceeds normally Both hooks are now executable and will automatically run when you perform git commits and pushes. ## Testing the Hooks You can test the hooks by: 1. Making a small change to a Rust file 2. Running `git add .` and `git commit -m "test"` to see the pre-commit hook in action 3. Running `git push` to see the pre-push hook in action ## Prerequisites Make sure you have the nightly Rust toolchain installed: ```bash rustup install nightly ``` The hooks will now ensure that your code is always formatted with `cargo +nightly fmt` before commits and pushes!