Skip to content

Instantly share code, notes, and snippets.

Last active October 27, 2016 14:27
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
A git hook to help you avoid adding to you commit information you don't want (i.e. debugging statement)
# This script verifies if a list of "undesired" words are presented in the files you are intented to commit such console
# output, debugging information or keys/tokens/passwords
# Based on the git hook created by Mark Story
# Instructions:
# Put this file into your .git/hooks folder and remove the .sh extension
# ---------------------------------------------
# Modify this
# LIST='list\|of\|words\|splitted\|by\|slash\|and\|pipe'
if git rev-parse --verify HEAD >/dev/null 2>&1; then
for FILE in `git diff-index --name-status --cached $against -- | cut -c3-` ; do
# Check if the file contains one of the words in LIST
if grep -w $LIST $FILE; then
echo $FILE." has one of the word you don't want to commit. Please remove it"
exit 1
Copy link

You're missing the "n" in "binding.pry"

btw thanks for the gist and the "Automate your Git flow" article, it was really helpful!

Copy link

@alexishevia: Thanks for pointing out the misspelling (Y) So glad you found the article useful. Thanks for reading!

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