Skip to content

Instantly share code, notes, and snippets.

@tscolari tscolari/aa.md
Created Jul 26, 2013

Embed
What would you like to do?
Work in progress
  • Avoids files with debugger/binding.pry to be commited
  • Avoids files with spaces in the end of the line to be commited

Instalation

  • Copy the file to .git/hooks/pre-commit
  • Make it executable chmod + x .git/hooks/pre-commit
  • Have fun
#!/bin/sh
ABORT=0
if [ "git diff --check > /dev/null" ]
then
echo $(git --no-pager diff --check | egrep trailing)
ABORT=1
fi
for FILE in `git diff-index --name-only HEAD` ; do
if [ "grep 'debugger|binding\.pry' $FILE" ]
then
echo $FILE ' -> INVALID'
ABORT=1
fi
done
if (( $ABORT ))
then
exit 1
fi
exit 0
@hubb

This comment has been minimized.

Copy link

commented Jul 26, 2013

Avoids files with spaces in the end of the line to be commited

Not a big fan of my commit being aborted because I have trailing whitespaces, why not removing them for me if I haven't configured my editor properly ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.