diff --git a/scripts/pre-commit.sample b/scripts/pre-commit.sample new file mode 100644 index 0000000..535c259 --- /dev/null +++ b/scripts/pre-commit.sample @@ -0,0 +1,9 @@ +#!/bin/sh + +# Copy this file to .git/hooks + +# Run clang-format before commiting +files=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(cpp|hpp)$') +[ -z "$files" ] && exit 0 +clang-format -i $files +git add $files