Posted By

lluis on 12/14/12


Tagged

hooks git pre-commit


Versions (?)

git pre-commit hook print alert


 / Published in: Bash
 

vim .git/hooks/pre-commit chmod +x pre-commit

clean print's with :lvim /print/gj ./**/.

  1. #!/bin/zsh
  2. # Script para evitar “prints” en el código que se añade al repositorio.
  3. ! grep -r -i[[:space:]]*print’ `git diff --name-only --staged` > /dev/null
  4. if [ $? -eq 1 ]; then
  5. echo “Se encontraron prints en el commit.”;
  6. exit 1
  7. fi
  8. exit

Report this snippet  

You need to login to post a comment.