Skip to content

Instantly share code, notes, and snippets.

@camallen
Forked from zwolf/pre-commit
Created December 15, 2016 10:27
Show Gist options
  • Save camallen/6dc02b3fe7e05f9d274f9def862ec64e to your computer and use it in GitHub Desktop.
Save camallen/6dc02b3fe7e05f9d274f9def862ec64e to your computer and use it in GitHub Desktop.
A pre-commit hook for git to alert if ":focus" (or similar) is found in a + line of a diff
#!/usr/bin/env ruby
if `git diff HEAD spec` =~ /^\+.*,\s?(:focus|focus:\s?true|:focus\s?=>\s?true)/
puts "\e[31mPlease focus and remove your :focus tags before committing :)"
exit 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment