Last active
August 29, 2015 13:57
-
-
Save dln/9483381 to your computer and use it in GitHub Desktop.
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 | |
| # | |
| # Set up user-wide: | |
| # | |
| # 1) Copy this file to ~/.git_template/hooks/pre-commit | |
| # 2) git config --global init.templatedir '~/.git_template' | |
| # 3) New repos will initialize from template. Use 'git init' on existing repos to install manually. | |
| # | |
| # Conflict markers | |
| git diff --cached --diff-filter=ACMR | awk '/\+(<<<[<]<<<|>>>[>]>>>|===[=]===$)/ { exit 1 }' | |
| CODE=$? | |
| if [ "$CODE" != "0" ]; then | |
| echo "COMMIT ABORTED: Conflict markers found." >&2 | |
| exit $CODE | |
| fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment