Last active
September 22, 2016 12:43
-
-
Save petRUShka/2f6d5e75f1e92dcd27e3 to your computer and use it in GitHub Desktop.
Git hook which is prevent you from commit code with breakpoints or focus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Should be placed in .git/hooks/pre-commit inside project dir | |
# Do not forget to install The Silver Search: https://github.com/ggreer/the_silver_searcher#linux | |
ag_output=$(ag --color "(:focus\b)|(^[^#\\n]+(byebug|binding\.pry))" `git diff-index --cached HEAD --no-commit-id --name-only | grep ".*rb$"` 2> /dev/null) | |
if [ $? == 0 ] | |
then | |
echo "There are undeleted :focus or breakpoint (byebug or pry-byebug) in following files:" | |
echo "$ag_output" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
had to made some changes for Debian (with sh linked to dash)