Skip to content

Instantly share code, notes, and snippets.

@vincode-io
Last active March 7, 2023 11:36
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Detect unresolved merge conflict markers using a Git pre-commit hook
#!/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