Skip to content

Instantly share code, notes, and snippets.

@visor
Created September 3, 2013 15:31
Show Gist options
  • Save visor/6425487 to your computer and use it in GitHub Desktop.
Save visor/6425487 to your computer and use it in GitHub Desktop.

Revisions

  1. visor created this gist Sep 3, 2013.
    8 changes: 8 additions & 0 deletions pre-commit
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    #!/usr/bin/bash

    FORBIDDEN='var_export\|error_log\|console\.log'
    git diff --cached --name-only \
    | grep -E '\.(js|php|css)$' \
    | GREP_COLOR='4;5;37;41' xargs grep --color --with-filename -n -e $FORBIDDEN \
    && echo "COMMIT REJECTED Found forbidden references. Please remove them before commiting" \
    && exit 1