Skip to content

Instantly share code, notes, and snippets.

@rmosolgo
Forked from tannermares/pre-commit
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmosolgo/28e6053c16105521f75f to your computer and use it in GitHub Desktop.
Save rmosolgo/28e6053c16105521f75f to your computer and use it in GitHub Desktop.
check for focus and console.log before committing
#!/usr/bin/env ruby
if `git diff --cached spec` =~ /,\s?(:focus|focus:\s?true|:focus\s?=>\s?true)/
puts "\e[31mRemove your :focus tags before committing!\e[0m"
exit 1
end
if `git diff --cached spec` =~ /console\.log/
puts "\e[31mRemove your console.log before committing!\e[0m"
exit 1
end
# put this in file: .git/hooks/pre-commit
# make it executable: chmod +x .git/hooks/pre-commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment