Skip to content

Instantly share code, notes, and snippets.

@DiegoSalazar
Created June 15, 2016 17:18
Show Gist options
  • Select an option

  • Save DiegoSalazar/0f4e81cb80c50128a890675b8d83bf4e to your computer and use it in GitHub Desktop.

Select an option

Save DiegoSalazar/0f4e81cb80c50128a890675b8d83bf4e to your computer and use it in GitHub Desktop.
git pre-commit hook to block changes containing the string debug in a ruby comment
#!/bin/sh
. git-sh-setup # for die
git-diff-index -p -M --cached HEAD -- | grep '^+' | grep -n '# debug' && die 'Blocking commit: debug detected in code'
:
@cparker15
Copy link

Thank you so much for writing this!

Your Gist is ranked #1 for the Google search:

git pre-commit block string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment