Skip to content

Instantly share code, notes, and snippets.

@robertocaldas
robertocaldas / pre-commit
Created November 7, 2024 08:39
Add file to /.git/hooks
#!/bin/bash
# Get the list of files to be committed
files=$(git diff --cached --name-only)
# Check each diff for the word 'static'
for file in $files; do
if git diff --cached "$file" | grep -q 'static'; then
echo "Error: The word 'static' was found in file: $file"
exit 1