Last active
August 29, 2015 14:15
-
-
Save RyanParsley/af3886affbe760a72339 to your computer and use it in GitHub Desktop.
Don't let poorly handled conflicts honey badger your repo
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 | |
| # CONFIG | |
| # Give options empty values to bypass checks ("OPTIONNAME=") | |
| # whether to check ig git merge conflicts have been added | |
| CONFLICTS=1 | |
| # Simple check for merge conflics | |
| if [[ -n $CONFLICTS ]]; then | |
| conflicts=`git diff --cached --name-only -G'((<<<<<< HEAD)|(\+======)|(\+>>>>>>))'` | |
| if [ -n "$conflicts" ]; then | |
| echo "Unresolved merge conflicts in this commit:" | |
| echo $conflicts | |
| fi | |
| fi | |
| # Something went wrong | |
| if [[ -n "$conflicts" ]]; then | |
| echo | |
| echo "Commit with '-n' to bypass checks" | |
| exit 1 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment