Added sample file for git hook
This commit is contained in:
9
scripts/pre-commit.sample
Normal file
9
scripts/pre-commit.sample
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user