Skip to content

Instantly share code, notes, and snippets.

@seppeljordan
Last active September 15, 2019 19:37
Show Gist options
  • Save seppeljordan/cf6ec473699f2c4038d42bb549deca23 to your computer and use it in GitHub Desktop.
Save seppeljordan/cf6ec473699f2c4038d42bb549deca23 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
# goes into .git/hooks/pre-commit
# do not forget 'chmod +x .git/hooks/pre-commit'
set -e
. ./format_code.sh
if ! git diff --exit-code > /dev/null 2>&1; then
echo "Incorrect formatting, run 'sh ./format_code.sh' to fix"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment