Last active
September 29, 2023 21:28
-
-
Save vincode-io/48f3394f379bac2351127dbe630f2233 to your computer and use it in GitHub Desktop.
Detect unresolved merge conflict markers using a Git pre-commit hook
This file contains 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/sh | |
# | |
# Add this to your .git/hooks/pre-commit file to detect unresolved merge conflict markers | |
# | |
CHECK=$(git diff --staged --check) | |
if [ ! -z "$CHECK" ] | |
then | |
echo "$(tput setab 1) WARNING $(tput sgr0) Conflict markers still present" | |
echo "-------------------------------------------------" | |
echo "$CHECK" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment