Skip to content

Instantly share code, notes, and snippets.

@mech
Forked from UnderpantsGnome/pre-commit
Created September 6, 2011 04:56
Show Gist options
  • Select an option

  • Save mech/1196623 to your computer and use it in GitHub Desktop.

Select an option

Save mech/1196623 to your computer and use it in GitHub Desktop.
My pre-commit hook
#!/bin/bash
debug=`git diff --cached | grep -C 2 -E '+\s*And (open|show me the page)'`
conflicts=`git diff --cached | grep -C 2 -E '<<<|>>>'`
if [ -n "$debug" ]; then
echo "debugging statements added in this commit"
echo $debug
fi
if [ -n "$conflicts" ]; then
echo "unresolved merge conflicts added in this commit"
echo $conflicts
fi
if [[ -n "$conflicts" || -n "$debug" ]]; then
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment