Skip to content

Instantly share code, notes, and snippets.

Last active March 7, 2023 11:36
What would you like to do?
Detect unresolved merge conflict markers using a Git pre-commit hook
# Add this to your .git/hooks/pre-commit file to detect unresolved merge conflict markers
CHECK=$(git diff --staged --check)
if [ ! -z "$CHECK" ]
echo "$(tput setab 1) WARNING $(tput sgr0) Conflict markers still present"
echo "-------------------------------------------------"
echo "$CHECK"
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment