-
-
Save mech/1196623 to your computer and use it in GitHub Desktop.
My pre-commit hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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